Re: sky is falling, again ? [message #75558] |
Wed, 16 March 2011 11:25 |
natha
Messages: 482 Registered: October 2007
|
Senior Member |
|
|
Thank you for all of these replies.
Now, I know where I have the problem...
My julian date is exactly what I want. The problem is when I convert
the date to local time.
I am doing something like: julian_time+=(SYSTIME(/UTC,/JUL)-SYSTIME(/
JUL))
The problem is this line. If I use the calendar format, sometimes
works, sometimes not.
nata
|
|
|
Re: sky is falling, again ? [message #75610 is a reply to message #75558] |
Wed, 16 March 2011 10:53  |
Fabzou
Messages: 76 Registered: November 2010
|
Member |
|
|
On 03/16/2011 06:06 PM, Kenneth P. Bowman wrote:
>> Because of this problem, we now defined our own time system based on
>> "milliseconds since ..." (working with LONG64 formats to be sure). It
>> works nice, but it was a long (and a bit boring) work to make it
>> flexible and stable.
>>
>> I was wondering what are you people doing?
>>
>> Fab
>
> I have a small library to do date and time calculations that are
> exact to the second using structures and integer arithmetic. It
> could be modified to add a millisecond or microsecond field.
>
> You can download it here
>
> http://idl.tamu.edu/idl/Downloads.html
>
> (see bowman_lib.zip)
>
> Ken Bowman
>
>
>
> IDL> date1 = MAKE_DATE(2011, 3, 16, 12, 4, 0)
> IDL> date2 = MAKE_DATE(2011, 3, 17, 12, 4, 0)
> IDL> print, TIME_DIFF(date2, date1)
> 86400
> IDL> print, MAKE_ISO_DATE_STRING(date1)
> 2011-03-16 12:04:00
> IDL>
Yeah, once again I re-did something that already exists thousands of
time ;-)
Reading this newsgroup regularly, I learned the most important thing
ever: "first look if someone didn't do it for you"
Nice community, by the way...
Fab
|
|
|
Re: sky is falling, again ? [message #75611 is a reply to message #75610] |
Wed, 16 March 2011 10:38  |
R.Bauer
Messages: 1424 Registered: November 1998
|
Senior Member |
|
|
Am 16.03.2011 17:52, schrieb Fabzou:
>
> On 03/16/2011 03:54 PM, Norbert Hahn wrote:
>> nata<bernat.puigdomenech@gmail.com> wrote:
>>
>> with the number of milliseconds missing. But you are close to
>> the next minute.
>> As usual with quantized values, the last digit may be wrong.
>>
>> Norbert
>
> Because of this problem, we now defined our own time system based on
> "milliseconds since ..." (working with LONG64 formats to be sure). It
> works nice, but it was a long (and a bit boring) work to make it
> flexible and stable.
>
> I was wondering what are you people doing?
>
We use julian seconds, defined as "seconds since 2000-01-01 00:00:00" by
Ray Sterner (JHUAPL). It is a double precision number.
Works very well. We also have timeaxis, setup_time_axis routines and
lots of conversion routines in our library.
Reimar
|
|
|
Re: sky is falling, again ? [message #75614 is a reply to message #75611] |
Wed, 16 March 2011 10:06  |
Kenneth P. Bowman
Messages: 585 Registered: May 2000
|
Senior Member |
|
|
In article <8uc870F5jqU1@mid.dfncis.de>,
Fabzou <fabien.maussion@tu-berlin.de> wrote:
> On 03/16/2011 03:54 PM, Norbert Hahn wrote:
>> nata<bernat.puigdomenech@gmail.com> wrote:
>>
>> with the number of milliseconds missing. But you are close to
>> the next minute.
>> As usual with quantized values, the last digit may be wrong.
>>
>> Norbert
>
> Because of this problem, we now defined our own time system based on
> "milliseconds since ..." (working with LONG64 formats to be sure). It
> works nice, but it was a long (and a bit boring) work to make it
> flexible and stable.
>
> I was wondering what are you people doing?
>
> Fab
I have a small library to do date and time calculations that are
exact to the second using structures and integer arithmetic. It
could be modified to add a millisecond or microsecond field.
You can download it here
http://idl.tamu.edu/idl/Downloads.html
(see bowman_lib.zip)
Ken Bowman
IDL> date1 = MAKE_DATE(2011, 3, 16, 12, 4, 0)
IDL> date2 = MAKE_DATE(2011, 3, 17, 12, 4, 0)
IDL> print, TIME_DIFF(date2, date1)
86400
IDL> print, MAKE_ISO_DATE_STRING(date1)
2011-03-16 12:04:00
IDL>
|
|
|
Re: sky is falling, again ? [message #75616 is a reply to message #75614] |
Wed, 16 March 2011 09:52  |
Fabzou
Messages: 76 Registered: November 2010
|
Member |
|
|
On 03/16/2011 03:54 PM, Norbert Hahn wrote:
> nata<bernat.puigdomenech@gmail.com> wrote:
>
> with the number of milliseconds missing. But you are close to
> the next minute.
> As usual with quantized values, the last digit may be wrong.
>
> Norbert
Because of this problem, we now defined our own time system based on
"milliseconds since ..." (working with LONG64 formats to be sure). It
works nice, but it was a long (and a bit boring) work to make it
flexible and stable.
I was wondering what are you people doing?
Fab
|
|
|
Re: sky is falling, again ? [message #75618 is a reply to message #75616] |
Wed, 16 March 2011 07:54  |
Norbert Hahn
Messages: 46 Registered: May 2003
|
Member |
|
|
nata <bernat.puigdomenech@gmail.com> wrote:
> Hi folks,
>
> I'm converting julian dates to text, using the calendar format. So,
> for example:
> time_text=2455636.937500d
>
> PRINT, STRING(time_text,FORMAT='(C(CDI2.2,"/",CMOI2.2,"/",CYI,"
> ",CHI2.2,":",CMI2.2))')
>
> CALDAT, time_text, mo, dd, yy, hh, mm
> PRINT, STRTRIM(dd,2)+"/"+STRTRIM(mo,2)+"/"+STRTRIM(yy,2)+"
> "+STRTRIM(hh,2)+":"+STRTRIM(mm,2)
>
> 16/03/2011 10:29
> 16/03/2011 10:30
>
> Lol ! There is 1 minute difference !!!! Do you know why ?
If you use
PRINT, STRING(time_text,FORMAT='(C(CDI2.2,"/",CMOI2.2,"/",CYI,"
",CHI2.2,":",CMI2.2,":",CSI2.2))')
to print time_text
you'll get
16/03/2011 10:29:59
with the number of milliseconds missing. But you are close to
the next minute.
As usual with quantized values, the last digit may be wrong.
Norbert
|
|
|