Re: Date Conversions

new topic     » goto parent     » topic index » view thread      » older message » newer message

Jonas Temple wrote:

> So his name is Carl!  I've looked for the author of datetime.e but
> could never find it!

Hmm. I was sure I had put my name in the package somewhere. After checking,
I haven't. Sorry about that. My name *is* listed if you search for 'date'
and 'time' at RapidEuphoria.com.

> Carl, I would like to second the motion.  I use datetime.e in about
> 75% of my programs.  It's a staple!

Thanks muchly. :)

> I do have one question.  If I have a value that is a number of seconds
> since the Unix Epoch and use secondsToDateTime() is the result exact
> or is it +/- a few minutes/seconds?  I've got a program that calls
> stat() for a Unix type file which gives me the last modified time.  I
> then use secondsToDateTime() and the result is a few minutes off from
> the actual time of last modification.

I suspect it's probably a timezone issue you're having. Epoch1970 (unix)
times are always stored as GMT/UTC regardless of your timezone. Since
datetime.e doesn't (can't) know which timezone you are in, it can't
compensate for the difference. You end up with a discrepancy of the number
of seconds fast or slow you are of GMT.

Try adding something like the following line right after the include for
datetime.e:

    Epoch = subFromDateTime(Epoch, {5,0,0}) -- subtract 5 hours = EST

...assuming you're on the East Coast of the United States. 'Epoch' is a
global DateTime used by EpochTimeTo1ADTime() specifically so that we can do
things like this.

Bruce "Stereotype" McCobber of Sydney, Australia would use the line:

    Epoch = addToDateTime(Epoch, {10,0,0}) -- add 10 hours to GMT

...and Daw Hnin-yi of Yangon, Myanmar would use:

    Epoch = addToDateTime(Epoch, {6,30,0}) -- add 6_1/2 hours to GMT

...etc.

HTH,
Carl

--
[ Carl R White -=- aka -=- Cyrek the Illogical ]
[ () E-mail...:     cyrek{}cyreksoft.yorks.com ]
[ /\ URL......: http://www.cyreksoft.yorks.com ]

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu