Re: How to handle a 64bit FILETIME?

From: Date: Thu, 03 Mar 2005 20:37:15 +0000
Subject: Re: How to handle a 64bit FILETIME?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-209946@lists.php.net to get a copy of this message
Richard Lynch wrote:
Tom Cannaerts wrote:
I'm processing a binary file, and in that file there is a 64bit FILETIME value. This value represents the number of 100-nanoseconds since 1/1/1601. I would like to convert it to a somewhat more usable value, since I eventually will need to display that value as a human readable date.
In addition to the BC_MATH package, there's some new-fangled extension to PHP that does the same kind of stuff. I'm not quite sure how you are going to get the 32 bytes into a string suitable for sending *TO* either of those packages, however... I'm guessing you'll have to read 32 bits, throw that into BC_MATH, multiply by 0xFFFFFFFF, grab the next 32 bits, and add that in BC_MATH... Then, you'll have to divide by 100-nanoseconds and/or subtract enough seconds to get to whatever time format you want to use. or, since you won't be showing it in such precision, you could cut off a whole bunch from the end, and simply divide by a factor 10^numbers_you_let_off less :)


« previous php.general (#209946) next »