1. Date Conversions

This is just a "thank you" note to Carl White for his Date Conversion 
library. I have used this to solve a client's problem. They have a web log 
file that didn't handle GMT conversions correctly so I wrote a small Eu 
program (1 hour's work) to convert the daily log file. It takes a few 
seconds to convert 3megs. They can't believe that it took so little time to 
write the utility, and it takes so little time to run. Another happy 
Euphoria end-user.

-- 

cheers,
Derek Parnell

new topic     » topic index » view message » categorize

2. Re: Date Conversions

Hi Derek,
     Glad to hear that! keep up, Mate

------
cheers,
jordah
----- Original Message -----
From: "Derek Parnell" <ddparnell at bigpond.com>
To: "EUforum" <EUforum at topica.com>
Subject: Date Conversions


>
> This is just a "thank you" note to Carl White for his Date Conversion
> library. I have used this to solve a client's problem. They have a web log
> file that didn't handle GMT conversions correctly so I wrote a small Eu
> program (1 hour's work) to convert the daily log file. It takes a few
> seconds to convert 3megs. They can't believe that it took so little time
to
> write the utility, and it takes so little time to run. Another happy
> Euphoria end-user.
>
> --
>
> cheers,
> Derek Parnell
>
>
>
> TOPICA - Start your own email discussion group. FREE!
>

new topic     » goto parent     » topic index » view message » categorize

3. Re: Date Conversions

Derek Parnell wrote:

> This is just a "thank you" note to Carl White for his Date Conversion
> library.

You're welcome. :)

>          I have used this to solve a client's problem. They have a
> web log file that didn't handle GMT conversions correctly so I wrote
> a small Eu program (1 hour's work) to convert the daily log file. It
> takes a few seconds to convert 3megs. They can't believe that it took
> so little time to write the utility, and it takes so little time to
> run. Another happy Euphoria end-user.

*Shudder* Log conversions. Been there, still do that - for customers here at
work. Unfortunately, we have 'tools' already to do the conversion. If I had
the time and (less specifically) the inclination, I'd rewrite them in Eu.

I was looking into making the library a bit more generic, i.e. allowing
parameters to functions that accept Dates to also accept DateTimes, etc. But
if it's speed people are wanting, maybe that's not such a good idea...

While I was examining the code, I found I've 'left the handbrake on' in the
library - there's a spurious 'with trace' in there that can be removed, and
there's a 'trace(1)' in one of the functions. Yuck. :(

I'll post an update to Rob when I have the time. ;)

Going to deflate head now,
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 message » categorize

4. Re: Date Conversions

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 message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu