comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: HELP with systime()
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: HELP with systime() [message #10887 is a reply to message #10877] Wed, 11 February 1998 00:00 Go to previous messageGo to previous message
Brian Jackel is currently offline  Brian Jackel
Messages: 34
Registered: January 1998
Member
Mark Elliott asked:

> Is there a way to convert a binary time value like the one
> returned by
>
> timeval = systime(1)
>
> into a date string like
>
> DOW MON DD HH:MM:SS YEAR ?
>
> I've found bin_date() but it accepts only the ascii_time format
> for input. I'd like to convert the number of seconds since 1/1/1970
> into the month,day,year,... that it corresponds to.
>

A couple years ago I wrote some code to do what you're asking
about. However, I recently discovered an easier way of doing
things, using the CDF_EPOCH function, which is part of the
Common Data Format library included with IDL. It can do two
things

1) Given a year,month,day etc. return the time in milliseconds
since a reference time (0 AD). Use this to find out when
the standard Unix reference time started:

CDF_EPOCH,UnixEpoch,1970,1,1,0,0,0,/COMPUTE_EPOCH

2) Turn a reference time back into year, month, day etc.
Add the number of milliseconds given by SYSTIME to
the Unix reference time

CurrentEpoch= UnixEpoch + SYSTIME(1) * 1000.0d0

Then recover the information you want

CDF_EPOCH,CurrentEpoch,year,month,day,hour,minute,second, $
/BREAKDOWN_EPOCH


which you can format as needed. Hope this helps. Oh,
there's one little problem. The CDF stuff works in
Universal Time, while SYSTIME tends to correct for the
current time zone. Be careful...

Brian Jackel
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: leaving room for a page title
Next Topic: Re: IDL: are dynamic arrays supported?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sun Oct 12 01:27:16 PDT 2025

Total time taken to generate the page: 1.75987 seconds