Has anybody tried to write alternative proc to
FileTimeToSystemTime.
I'll be glad to see at least math logic.
I disasm the original API func. but not sure that
got it right.
I now that it is a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601.
But I'm not sure about calendar calculation logic.
We changed it too friequantly in Russia :)
The Svin.
I started with your task on the file times once, and tried to create such a function, but it got a little too complicated and I haven't tried it further.
I did some research about dates, leap days etc. I thought about methods of getting the year from the 64-bit value. I found that a year is actually 365.24219 days. The leap years every 4th year, except on the century turn if the year is not divisible by 400, try to resemble this value closely (365.2425 actually). I thought about dividing the value by 365.2425 (in 100-nanoseconds) to get the number of years since 1601, but I got stuck and I didn't know if the maths were ok. Maybe this is of some help. I'll take a look at the disassembly of FileTimeToSystemTime, too.
Thomas
This message was edited by Thomas, on 3/16/2001 6:17:39 PM
I'm not sure if this is what you are looking for, but:
On Iczelion's site my program for an alarm clock/ stopwatch/ and
timer is posted under: Alarm & Countdown Timer
The program uses both SystemTime and FileTime structures and
use SystemTimeToFileTime convertions to calculate the difference
between the current time and the alarm time, also the amount of
elapsed time on the stop watch.
The DateTimePicker control is used which handles display and input
of date and time in any format.
If this is close to what you are looking for I'll be glad to help
if I can
Joe
Thax,Farrier.
I wish to replace FileTimeToSystemTime and SystemTimeToFileTime
with my own proc. 'Cause they are slow as hell.
I know how to use them though and all struct involved :)
I need just math model, and I will do the rest with my
humble abilities.
The Svin.
I had to look for it, but I found a dBase algorthym I wrote
12 years ago. I modified the psuedo-code to take into
consideration the time included in the date/time representation
of the Filetime structure.
I think I've got it right, but every time I look at it, I find
another error. The 'code' is too long to post here, but if you
are interested I'll e-mail it to be posted to the list somewhere.
Can we do that easily? Post prospective code samples to this
list?
Farrier
I don't quite understand about the list, but if could
email me your code I'll be glad.
Sorry I didn't answer at once, I have Inet connection
from time to time.
The Svin.