Inverse for localtime().

Guy Harris guy at auspex.auspex.com
Thu Aug 31 04:21:59 AEST 1989


>SunOS 4.x (possibly also 3.x)

No, not 3.x - it first appeared in 4.0.

>I thought it was natural for there to be an inverse to localtime().

So do a lot of people, but the notion of a standard inverse function of
that sort is relatively recent, alas....

>Does this mean that this is another useful SunOS'ism [like statfs(2)]
>only available on Suns,

"statfs()" was, originally, a SunOS-ism, but is hardly available only on
Suns.  System V Release 3 picked up the idea, and has a slightly
different version of it (same name, though); it also comes with the NFS
source distribution, so any version of UNIX that includes NFS where the
people who put NFS into their system knew what they were doing also
includes "statfs()".  It's a useful function on any UNIX system that
supports multiple file system types - whether local (V7/S5 file system,
BSD file system, etc.) or remote (NFS, RFS, etc.).  (S5R4 will have
"statvfs", which is "statfs" with some additions, as well as "statfs".)

"timelocal()" originally appeared in the Arthur Olson time zone code,
which was picked up by Sun in SunOS 4.0.  It was presented as
"standard-inspired", since it does not appear in any standard, but was
inspired by the "mktime()" routine proposed for the ANSI C standard.

>or will this spread to other platforms?

I don't know that "timelocal()" will - in fact, it'll be deprecated in
SunOS 4.1, in favor of "mktime()", although it will still be present and
supported.  However, I expect "mktime()" - which, as long as you set
"tm_isdst" of the "struct tm" you pass to it to a negative value,
behaves the same as "timelocal()" - to spread to most platforms, since
the proposed ANSI C standard requires it.  The latest version of the
Arthur Olson time zone code includes "mktime()", and it will be present
in SunOS 4.1. 



More information about the Comp.unix.questions mailing list