× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.






How would this program work for date before 01/01/1970.  They are negative
numbers.



----------------------------
Bryan Dietz



midrange-l-bounces@xxxxxxxxxxxx wrote on 05/29/2004 02:39:28 AM:


> Here's a trivial RPG program that converts the number of seconds to an
RPG
> timestamp field:
>
>      D unixts          s             10U 0 inz(1074528964)
>      D epoch           s               z   inz(z'1970-01-01-00.00.00')
>      D ts              s               z
>
>      c     epoch         adddur    unixts:*S     ts
>      c                   dsply                   ts
>      c                   eval      *inlr = *on
>
> That timestamp will also be in the UTC timezone.  Unfortunately, there's
> no good way (that I know of) to convert that time to the local timezone.
> You could use an API like CEEUTCO to get the number of seconds difference
> between the current timezone and UTC, and simply add that number of
> seconds -- the problem is, CEEUTCO, (which is based on the system value
> QUTCOFFSET) only knows what the UTC offset is AT THE MOMENT.  It doesn't
> know what it was in January.  Thanks to the fact that you change the
> timezone at daylight savings time, the number it returns might not be
> correct.
>
> To really solve the problem, you need to know whether it's currently
> daylight savings time, and whether the date in question would've been
> during daylight savings time -- and then adjust it by one hour (3600
> seconds) if necesary.
>
> Of course, you may not care that much... :)  I know I'd be content with
> just reading the UTC time in a human-readable format...


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.