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

Home » Public Forums » archive » Time Woes
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: Time Woes [message #30548 is a reply to message #30471] Thu, 02 May 2002 14:51 Go to previous messageGo to previous message
thompson is currently offline  thompson
Messages: 584
Registered: August 1991
Senior Member
btupper@bigelow.REMOVE.org (Ben Tupper) writes:

> On Wed, 1 May 2002 13:41:10 -0600, David Fanning <david@dfanning.com>
> wrote:

>> I have a time array that purports to be the number of seconds
>> from 1 Jan 1980. How in the world do I convert that to something
>> I can use with routines I have access to?
>>

> Howdy,

> Do you mean that you want to know a Julian time stamp or Calendar date
> for the time array values? I don't have IDL in front of me right now
> so I can't check this, and I can't clearly recall the syntax.

> (The following supposes the 'seconds' are just the run-of-the-mill
> kind of seconds...)

> ; start time in seconds
> t0 = JulDay( 0,1 1980, 0, 0, 0)
> ; add the elapsed time since t0
> t[i] = t0 + timeArray[i]
> ;convert to calendar values
> CalDat, t[i], month, day, year, hour, min, sec

> I have a sneaky feeling that your problem is more complicated than
> this solution will bridge. The only thing I do well with time (in
> IDL) is squander it, but I hope it helps anyway.

There is an ambiguity in the problem. It isn't obvious whether the seconds in
timeArray include leapseconds or not. In other words, is it a UTC-based time,
or a TAI-based time? The difference in the two between 1-Jan-1980 and today is
13 seconds. Depending on your point of view that could be negligable or a
major mistake.

My gut feeling is that your data is UTC-based. This would make it comparable
to Unix time, which is the number of (non-leap) seconds since 1-Jan-1970, and
which in IDL is returned with SYSTIME(1). In that case, using the JulDay and
CalDat procedures would give you exactly the correct answers.

If on the other hand, the data you have is TAI-based, and you care about the
distinction, you might want to check out my routines utc2tai.pro and
tai2utc.pro, which are available at

ftp://sohoftp.nascom.nasa.gov/solarsoft/gen/idl/time/

William Thompson

P.S. By the way, wouldn't that be

; start time in seconds
t0 = JulDay( 1,1, 1980, 0, 0, 0) * 86400.D0

;^)
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: default window size
Next Topic: Call_External and referenced symbol not found

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

Current Time: Sun Oct 12 00:54:27 PDT 2025

Total time taken to generate the page: 0.79985 seconds