Questions tagged [microtime]

Anything related to programming languages functions (or other similar facilities) allowing the retrieval of the current time with a resolution in the microseconds range.

Anything related to programming languages functions (or other similar facilities) allowing the retrieval of the current time with a resolution in the microseconds (µs) range.

103 questions
3
votes
2 answers

php microtime() format value

PHP's microtime() returns something like this: 0.56876200 1385731177 //that's msec sec That value I need it in this format: 1385731177056876200 //this is sec msec without space and dot Currently I'm doing something this: $microtime = …
Matías Cánepa
  • 5,201
  • 4
  • 49
  • 88
3
votes
3 answers

How to get any datetime in microseconds from any date in php

i'm wondering if there's a way to get any datetime in microseconds. I was looking forward microtime(), but it just returns the date in the moment. Anyone knows if is this possible? I have my date given like: Y-m-d H:i:s.u. I was thinking about…
GustavoxD
  • 89
  • 8
3
votes
1 answer

PHP 5.5 on Windows microtime() behavior

I'm trying to profile my Kohana project using Profiler. I'm on XAMPP on Windows with php 5.5.3. On this version of PHP I'm getting 0.000000 sec. execution time for main request, find_file() or database calls. Same behavior with PHP 5.4.19. If I move…
Kanstantsin K.
  • 492
  • 4
  • 17
2
votes
1 answer

In PHP it possible to use microtime() inside another microtime()?

I have a loop with a number of functions I want to check how long the entire loop runs, and also each of the functions within the loop Is it possible to use a parent and many child microtime functions simultaneously? $start =…
Dazzle
  • 2,196
  • 3
  • 18
  • 40
2
votes
4 answers

how to convert minutes into microtime

I have a session which contains microtime(true) value. like below: Yii::app()->user->setState('portal_logged_time', microtime(true)); Now i want to add 15 minutes in above session, but it should remain in microtime. $starttime =…
DS9
  • 2,831
  • 4
  • 40
  • 91
2
votes
2 answers

How to use Regex to match PHP time() or microtime() in a string?

I currently have a regex command which matches php time in a string: preg_match( '/([a-z]+)_([0-9]{9,})\.jpg/i', $aName, $lMatches ); How can I modify this to also match microtime() in the same match? Examples: foobar_1453887550.jpg…
David
  • 14,182
  • 34
  • 96
  • 150
2
votes
2 answers

Fetching data from mysql table using php microtime not working properly

I am displaying a long list of sales details from a table in mysql. The problem is I am being able to fetch data only for a month. As soon as the month changes it doesnt display anything. For ex: data being displayed from 1/05/2015 to 30/05/2015 but…
Ayan
  • 1,952
  • 2
  • 21
  • 58
2
votes
1 answer

Measuring the time of PHP scripts - Using $_SERVER['REQUEST_TIME']

Are this methods a reliable way to measure a script: $time = ($_SERVER['REQUEST_TIME_FLOAT'] - $_SERVER['REQUEST_TIME']); or $time = (microtime(true) - $_SERVER['REQUEST_TIME_FLOAT']); Which one should be used? And what's the difference of each…
Ash501
  • 301
  • 2
  • 4
  • 10
2
votes
3 answers

Microtime always returns same values multiple?

So I created a file microtime.php and tested it on my Windows Server 2008 R2 64x Enterprises running nginx dedicated server. '; echo microtime() . '
'; echo '
'; } ?> and I…
2
votes
2 answers

Which is better Storing hash value or the bigint variable from which the hash value is generated

I have a table in which a column stores image src which is in hash value and that hash value is generated from microtime(),Now I have two choice storing directly hash value in database or storing that bigint microtime from which the image name is…
user1432124
1
vote
0 answers

convert Unixtime to microtime

The data aer in der MySql database, the dates in unixtime. I coulde save it ohterwise, the input from the user is a norlman date dd.mm.YYY, I transform it as a Unixtime in to the database. Now I should make an output as a sheduler or a grantt. I…
tgh
  • 11
  • 1
1
vote
3 answers

MySQL greater than with microtime timestamp

I have one PHP script inserting rows in a MySQL database. Each row has a field 'created_at' which is filled with the value of the PHP function microtime(true), and inserted as a double. (microtime because I need something more precise than to the…
Dieter
  • 1,610
  • 2
  • 14
  • 28
1
vote
5 answers

PHP - using microtime() to measure CPU usage of a function/code block

I tried using it like this: $now = microtime(true); // cpu expensive code here echo microtime(true) - $now; but regardless of what code I enter between these statements, I alwasy get almost the same results, something like…
Alex
  • 60,472
  • 154
  • 401
  • 592
1
vote
1 answer

MD5 ($_POST['username'] + microtime()) says it encountered a non-numeric value since new PHP version

I reinstalled WAMP and now I have PHP version 7.1.9 (before this I had 7.0 x). A part of the code doesn't work anymore without warning/notice reports. - Warning: A non-numeric value encountered in And: - Notice: A non well formed numeric value…
user4908898
1
vote
1 answer

PHP microtime missing digits

In PHP, when using microtime(true), I am expecting to get in most cases 6 digits to the right of the decimal.
matt
  • 223
  • 4
  • 12