microtime - Get Time Ticks in PHP -


consider line of code in c#

ordernumber.value = datetime.now.ticks.tostring(); 

how same ordernumber.value in php

$ordernumbervalue = microtime(); //? 

i try

echo microtime(true) * 10000000;

but result string.length difference. short length c#.

from .net documentation:

datetime.ticks property

the value of property represents number of 100-nanosecond intervals have elapsed since 12:00:00 midnight, january 1, 0001 (0:00:00 utc on january 1, 0001, in gregorian calendar), represents datetime.minvalue. not include number of ticks attributable leap seconds.

in php implemented time():

time

returns current time measured in number of seconds since unix epoch (january 1 1970 00:00:00 gmt).

microtime() returns time in seconds , microseconds after decimal point, has greater precision. archaic reasons, default value string, if pass true first argument, you'll nice float:

rr-@burza:~$ php -r 'echo microtime(true);' 1434193280.3929%     

so have scale value returned either time() or microtime() constant factor.

according wikipedia, nanosecond equal 1000 picoseconds or 1⁄1000 microsecond, or 1/1000000000 second. 100 nanoseconds mean 100/1000000000 microseconds, i.e. 1 .net tick = 1/10000000 second, i.e. 1 second = 10000000 .net ticks. need multiply value returned time() or microtime() 10000000 this:

microtime(true) * 10000000 

Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -