The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers > Answers to Frequently Asked Questions > Tips and Tutorials
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #6 (permalink)  
Old 02-20-2007
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,119
Miscellaneous Odds and Ends

Your OS Imposes Limits On The Range of Dates That It Can Format
You need to check the documentation for your system to which dates it can handle.

For example, HP-UX 11i Version 2 says:
The minimum date supported by mktime() in both 32-bit and 64-bit HP-UX is Friday December 13 20:45:52 UTC 1901. The maximum dates supported by mktime() are Tuesday January 19 03:14:07 UTC 2038 and Friday December 31 23:59:59 UTC 9999 in 32-bit HP-UX and 64-bit HP-UX, respectively. If the calendar time cannot be represented, the function returns the value (time_t)—1 and sets errno to ERANGE. Note the value (time_t)—1 also corresponds to the time 23:59:59 on Dec 31, 1969 (plus or minus time zone and Daylight Saving Time adjustments). Thus it is necessary to check both the return value and errno to reliably detect an error condition.

Solaris 10 says:
The zoneinfo timezone data files do not transition past Tue Jan 19 03:14:07 2038 UTC. Therefore for 64-bit applications using zoneinfo timezones, calculations beyond this date might not use the correct offset from standard time, and could return incorrect values. This affects the 64-bit version of localtime(), localtime_r(), ctime(), and ctime_r().

Nanosecond Resolution
I notice that Posix is specifying a variety of nanaosecond resolution routines. I see that Solaris 10 has implemented them. I have no experience with them and I have ignored them for this thread. The clock_settime(3RT) man page says:
Quote:
A clock_id of CLOCK_HIGHRES represents the nonadjustable, high-resolution clock for the system. For this clock, the value returned by clock_gettime(3RT) represents the amount of time (in seconds and nanoseconds) since some arbitrary time in the past; it is not correlated in any way to the time of day, and thus is not subject to resetting or drifting by way of adjtime(2), ntp_adjtime(2), settimeofday(3C), or clock_settime(). The time source for this clock is the same as that for gethrtime(3C).
This implies that the nanosecond resolution routines are not intended for timekeeping. On the other hand, I see ls now has a -E option to display file times in nanoseconds.

If you display the time in nanoseconds, be sure to keep your eyes very close to the screen. Light cannot travel even a full foot in a nanosecond.

Further Reading
Be sure to read mtime, ctime, and atime for information about the timestamps of files.