× 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.



L. Maartens wrote:
Suggestions anyone?

Hah! I thought of something else right after I pressed send on the last message. If what you want is the time from the software clock, here is some C code that will do that (posting C since that's what I have and since you are using gettimeofday() you must know how to use C code in RPG):


  time_t curtime;
  struct tm *curdate;

  curtime = time (NULL);
  curdate = localtime (&curtime);

The nice thing about this is that you can use the elements of struct tm to get nice values such as year, month, day, hour, minutes, seconds, etc.

One interesting thing to note about the above code is that time() will increment predictably even over a daylight savings change. That is because time() returns the number of seconds since January 1, 1970 - not the actual time of day (i.e. 4:00 p.m. on Oct. 29, 2003). localtime() translates the number of seconds to a representation of the date and time. Therefore the representation can go back and forward an hour but the actual time continues uninterrupted.

Also note that the time() function has been obsoleted by gettimeofday() in BSD 4.3. But it still works on all my systems.

James Rich

"As for security, being lectured by Microsoft is like receiving wise words on the subject of compassion from Stalin."
-- mormop on lwn.net



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.