|
Re: Posix Time Functions [message #17749 is a reply to message #17745] |
Thu, 11 November 1999 00:00  |
Ben Tupper
Messages: 186 Registered: August 1999
|
Senior Member |
|
|
In article <942358684.298839@clam-55>, "Mark says...
>
> Ben Tupper <Ben_member@newsguy.com> wrote in message
> news:80f3b3$2tm1@edrn.newsguy.com...
>> ... I just happened to need something like this recently
>> when working with instrument data. Each measurement was stamped with
> Julian
>> seconds elapsed since October 15, 1582.
>
> How do people come up with these strange time origins!
>
Even stranger is that the metadata makes no mention of this date (It took some
group noodling to figure out.)
Ben Tupper
PemaquidRiver@tidewater.net
|
|
|
|
Re: Posix Time Functions [message #17754 is a reply to message #17749] |
Thu, 11 November 1999 00:00  |
Ben Tupper
Messages: 186 Registered: August 1999
|
Senior Member |
|
|
In article <382A51B0.44D1CB18@mindspring.com>, Eric says...
>
> I posted this a while a go but didn't hear anything so I thought I'd
> take one more shot. Does anyone know of / have any POSIX time functions
> for IDL? That is a function which takes seconds since Jan, 1 1970 and
> returns a nice date structure (year, month, day,etc..). Such beasties
> are plentiful in Java, C etc so I figure one should be in IDL also.
>
>
Try something like this... I just happened to need something like this recently
when working with instrument data. Each measurement was stamped with Julian
seconds elapsed since October 15, 1582.
FUNCTION POSIX_TIME, Seconds
;convert seconds since 1-1-1970 to a comparable Julian Days elapsed
ElapsedJulianDays = Seconds/(60.*60.*24.)
; get the Julian day number for the benchtime
BenchTimeJulianDay = JulDay(1,1,1970)
; add the number of days elapsed to the BenchTime less one
TargetDayJulian = ElapsedJulianDays + BenchTimeJulianDay - 1.
; convert back to familiar calendar date
CalDat, TargetDayJulian, Month, Day, Year
Return, {Month:Month, Day:Day, Year:Year}
End
Ben Tupper
PemaquidRiver@tidewater.net
|
|
|
Re: Posix Time Functions [message #17764 is a reply to message #17749] |
Thu, 11 November 1999 00:00  |
Liam Gumley
Messages: 473 Registered: November 1994
|
Senior Member |
|
|
Eric Kihn wrote:
> I posted this a while a go but didn't hear anything so I thought I'd
> take one more shot. Does anyone know of / have any POSIX time functions
> for IDL? That is a function which takes seconds since Jan, 1 1970 and
> returns a nice date structure (year, month, day,etc..). Such beasties
> are plentiful in Java, C etc so I figure one should be in IDL also.
How about this:
IDL> julian = systime(/julian)
IDL> caldat, julian, month, day, year, hour, minute, second
IDL> print, julian, month, day, year, hour, minute, second
2451493.9 11 11 1999
8 35 19.999981
Note that my Unix host is set to US Central Standard Time.
Cheers,
Liam.
--
Liam E. Gumley
Space Science and Engineering Center, UW-Madison
http://cimss.ssec.wisc.edu/~gumley
|
|
|