Re: a little math

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, April 20, 2007 3:55 am, Sebe wrote:
> maybe someone can figure why sometimes i get negative values for
> seconds..
>
> $job['finished'] and $job['finished'] are both unix timestamp.
> i subtract both to get how many seconds some thing took.. well you
> should be able to read the rest. sometimes it works fine but other
> times
> i get negative seconds.


If you are using microtime, and you are not using the new-fangled
extra arg to get the value as "seconds.microseconds" instead of
".microseconds seconds" then you aren't accounting for the seconds
part, only the .microseconds part.

Very common beginner mistake.

And you're not actually using a Unix timestamp, but a Unix
micro-timestamp, I guess...

http://php.net/microtime/

If you are NOT using microtime, please DO tell us what you are
cramming into $job[] so we can help you.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux