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
0
votes
0 answers

PHP - how to generate different timestamps in the loop?

How can I loop an array and create different timestamp for each iteration? $array = array( 1 => 'one', 2 => 'two' ); foreach( $array as $key => $value ){ var_dump( "CONTENT_" . round(microtime(true) * 1000)); } Result: string(21)…
laukok
  • 47,545
  • 146
  • 388
  • 689
0
votes
2 answers

PHP microtime - microseconds format

If PHP's microtime() function were to be executed at a point in time where the resulting microseconds are zero, what format does it result in? Would it look like this? 0.00 1467926279? Or this? 0 1467926279 The manual doesn't provide a numerical…
loxyboi
  • 1,078
  • 3
  • 15
  • 26
0
votes
1 answer

memory_get_usage() & microtime()

Good day! I have this code: final class bench { protected static $start_time; protected static $start_memory; public static function start() { self::$start_time = microtime(true); self::$start_memory =…
0
votes
1 answer

How to format time difference with micro seconds

I want to get the time difference between the two times below. The format of the time difference should be hours minutes seconds and then micro seconds. I want the final answer in this format only. $start = date(' H:i:s'.substr((string)microtime(),…
BEDI
  • 41
  • 10
0
votes
2 answers

PHP - Convert specific hour into microtime

I need to know how to convert 07:00pm of the current date in microtime. Sorry if this is a silly question but I cannot find the answer anywhere
Anonymous
  • 911
  • 1
  • 8
  • 22
0
votes
1 answer

Php microtime() is not working on live site. Looking for workaround

I have Zend Server 6.3 and Php 5.4 on Windows. And system works very well. Now I moved code to live site, which runs Php 5.3.29 on Ubuntu Server with DirectAdmin. All other website are running well there. But my current website gives me this error…
KestutisIT
  • 195
  • 3
  • 13
0
votes
2 answers

microtime in second with 2 decimals

I try calculate time of an act in second with 2 decimals. protected function microtimeFormat($data) { $duration = microtime(true) - $data; $hours = (int)($duration/60/60); $minutes = (int)($duration/60)-$hours*60; …
alia an
  • 103
  • 1
  • 7
0
votes
3 answers

Force to display regular decimal number

I'm running a benchmark test of doing nothing so the results is pretty fast. Here is my code: $time_start = microtime(true); //Do Nothing... $time = microtime(true) - $time_start; echo 'Took '.$time.' seconds
'; The problem is when I try to…
iprophesy
  • 165
  • 2
  • 9
0
votes
1 answer

remove all strings from microtime and add minutes to it

im usng this code to get php microtime $date = round(microtime(true) * 1000); the echo result i get like this 1.42020381242E+12 how do i make sure the microtime is just numbers no special characters or strings like this 1420209804538 on the…
0
votes
0 answers

PHP send attachment using PHPMailer - slow execution

currently I'm trying to send emails with file attachements using PHPMailer. Unfortunatelly, each script execution takes approximatelly 60 seconds to send a message. here is my code: $time_start =…
Jakub Pastuszuk
  • 718
  • 2
  • 10
  • 24
0
votes
0 answers

Zend_View_Helper_Partial - performance measure

I am trying to extend the zend partial helper to make it a little faster for my own needs. The code of how I do that is not important at this point. I have created a unit test which acts weird and I can not understand the reason for it this is the…
iosifv
  • 859
  • 6
  • 21
0
votes
1 answer

Hold time in session and compare the difference

I have a code that I want to check for time differences. This code below will check the the time start and time end then it will display the total time taken. When I first load the page, the time will initialize in session. After that I will wait…
sg552
  • 1,365
  • 4
  • 26
  • 53
0
votes
1 answer

Moving from MySQL 5.5 to GAE with cloud SQL : Microtime support?

Background: I have a project running on Laravel 4 with PHP 5.4.10 and MySQL 5.5 Due to the high performance requirements the Project has most of its business logic in Stored MySQL procedures, and for debugging and logging purposes each procedure…
Johannes
  • 5,628
  • 8
  • 30
  • 51
0
votes
2 answers

timestamp to include milisec php

i have a function that uses current timestamp to fetch some data and sql table, but some data get's doubled because the are in the same second and runs twice. I need to fetch them with timestamp including miliseconds. i use $timestamp =…
user3127632
  • 377
  • 5
  • 20
0
votes
3 answers

Find out for how long the script was running for in seconds?

I have a script which runs in a 'while' cycle. I need to determine for how long the script was running for and if it is over 10 seconds terminate it. The code I wrote returns weird decimal values (one second it might be '5.342...' and other it might…
Kristina Brooks
  • 14,589
  • 25
  • 101
  • 178