1. Re: datetime.e
- Posted by euphoria at carlw.legend.uk.com Jul 04, 2001
- 361 views
sephiroth _ wrote: i just tried a little program in C. 8< [snip C] 8< > oddly enough, when you run [the code] with the argument 0, it prints "1/1/1969 > 19:00:00". call me crazy, but doesn't that sound like new year's day > 1969, 9 PM? either something is wrong with my linux box, or something is > wrong with the docs where you got the exact date of the epoch sephiroth_ corrected: > tiny correction, it really prints 12/31/1969. and it does the same thing > in windows, too What you're experiencing is the fact that 'Unix seconds format' is GMT based, as is the 1970 Epoch in the library - you're suffering Time Zone dilation. :) You'll have to convert the GMT (also known as Universal Time) to your local time, which from your example must be 5 hours behind GMT. Try: constant myTimeZone = -hmsToSeconds({5, 0, 0}) integer unknownTime -- get unknown time from somewhere ? secondsToDateTime(unknownTime - myTimeZone) Or you could change the Epoch global variable. If you add this line at the top of your code, just after including datetime.e, you shouldn't need to change anything else: Epoch = subFromDateTime(EPOCH_1970, {5, 0, 0}) -- correct for Time Zone -5hrs Bear in mind that when Autumn comes around, your timezone relative to GMT will change when you revert to Winter Time from Summer Time. This is why the Unix creator(s) decided to use one timezone as a basis. It just gets confusing otherwise... The downside is that there's no built-in facility for getting the current timezone and daylight savings in Euphoria, so I can't add features to the library to support it. :( Carl PS I hope I have the subtractions right in the above... :-S :) -- Carl R White - aka - Cyrek eMail: carlw at legend.co.uk cyrek at bigfoot.com URL: nope none nada zip