Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ ctime(S) — Xenix 2.3.4g

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

environ(M)

getenv(S)

time(S)

tz(M)



     CTIME(S)                 XENIX System V                  CTIME(S)



     Name
          ctime, localtime, gmtime, asctime, tzset - Converts date and
          time to ASCII.

     Syntax
          char *ctime (clock)
          long *clock;

          #include <time.h>
          #include <sys/types.h>

          struct tm *localtime (clock)
          long *clock;

          struct tm *gmtime (clock)
          long *clock;

          char *asctime (tm)
          struct tm *tm;

          void tzset ( )

          extern long timezone;
          extern long altzone;
          extern int daylight;
          extern char *tzname[2];

     Description
          ctime converts a time pointed to by clock (such as returned
          by time(S)) into ASCII and returns a pointer to a 26-
          character string in the following form:

               Sun Sep 16 01:03:52 1973\n\0

          If necessary, fields in this string are padded with spaces
          to keep the string a constant length.

          localtime and gmtime return pointers to structures
          containing the time as a variety of individual quantities.
          These quantities give the time on a 24-hour clock, day of
          month (1-31), month of year (0-11), day of week (Sunday =
          0), year (since 1900), day of year (0-365), seconds from GMT
          (East < 0), a flag that is nonzero if summer time (daylight
          saving time) is in effect, and the name of the timezone.
          localtime corrects for the time zone and possible summer
          time.  gmtime converts directly to Greenwich time (GMT),
          which is the time the XENIX system uses.

          asctime converts the times returned by localtime and gmtime
          to a 26-character ASCII string and returns a pointer to this
          string.




     Page 1                                           (printed 8/7/87)





     CTIME(S)                 XENIX System V                  CTIME(S)



          The structure declaration for tm is defined in
          /usr/include/time.h.

          The external long variable timezone contains the difference,
          in seconds, between GMT and local standard time (e.g., in
          Eastern Standard Time (EST), timezone is 5*60*60);
          similarly, the external long variable altzone contains the
          difference, in seconds, between GMT and local summer time
          (e.g., in Eastern Daylight Time (EDT), altzone is 4*60*60);
          the external integer variable daylight is nonzero if and
          only if summer time conversion should be applied.

          If an environment variable named TZ is present, asctime uses
          the contents of the variable to override the default time
          zone as determined by ftime() (see time(S)).  The value of
          TZ is described in detail on the tz(M) manual page.  The
          effects of setting TZ are thus to change the values of the
          external variables timezone, altzone, and daylight.  In
          addition, the time zone names contained in the external
          variable

               char *tzname[2] = {"EST", "EDT"};

          are set from the environment variable.  The rule for when to
          change between standard time and summer time can be
          specified in the TZ string. If a rule is not specified, the
          standard U.S.A.  Daylight Savings Time conversion is
          applied.  The program knows about the peculiarities of this
          conversion in 1974 and 1975 and the change in 1987.  The
          function tzset sets the external variables from TZ ; it is
          called by asctime and may also be called explicitly by the
          user.

     See Also
          environ(M), getenv(S), time(S), tz(M)

     Notes
          The return values point to static data, whose content is
          overwritten by each call.

          Changes to TZ are immediately effective, (i.e. if a process
          changes the TZ variable, the next call to a ctime(S) routine
          returns a value based on the new value of the variable).












     Page 2                                           (printed 8/7/87)



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026