Convert rtems_clock_time_value to UTC (ascii)

Joel Sherrill <joel@OARcorp.com> joel.sherrill at OARcorp.com
Tue Jul 26 14:16:05 UTC 2005


Ian Caddy wrote:
> Hi Rolf,
> 
> We have this problem as some of our older systems use psos as the OS, so 
> we have a conversion utility that converts between RTEMS time and 
> standard unix time.  The definition we use is:
> 
> #define DELTA_1988_1970_SECS 
> (((1988L-1970L)*365L+(1988L-1970L)/4L)*24L*60L*60L)
> 
> I hope this helps.

The POSIX time routines have a similar conversion.  It is
called POSIX_TIME_SECONDS_1970_THROUGH_1988.  I think
clock_gettime for CLOCK_REALTIME is equivalent to what you are
wanting.

int clock_gettime(
   clockid_t        clock_id,
   struct timespec *tp
)


> regards,
> 
> Ian Caddy
> 
> 
> Rolf Schroedter wrote:
> 
>> My measurement data has an RTEMS timestamp in seconds,microseconds 
>> (rtems_clock_time_value). How can I convert this value later to 
>> human-readable UTC.
>> Obviously gmtime() cannot be used, because the RTEMS value has an 
>> offset to UNIX-style time_t.
>>
>> Is there a constant #define'ed, which should be added to get a UNIX 
>> time_t ?
>>
>> Thanks & regards,
>> ROLF.
>>
>> ------------------------------------
>> Rolf Schroedter
>> German Aerospace Center
>> Institute of Planetary Research
>> D-12489 Berlin, Rutherfordstrasse 2
>> Tel/Fax:  (+49) (30) 67055-416/384
>> Email:    Rolf.Schroedter at dlr.de
>>
>>
> 


-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel at OARcorp.com                 On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
    Support Available             (256) 722-9985




More information about the users mailing list