Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ gmtime(3c) — DG/UX 4.00

Media Vault

Software Library

Restoration Projects

Artifacts Sought



                                                                ctime(3c)



        _________________________________________________________________
        ctime, localtime, gmtime, asctime, tzset
        convert date and time to string
        _________________________________________________________________


        SYNTAX

        #include <time.h>

        char *ctime (clock)
        long *clock;

        struct tm *localtime (clock)
        long *clock;

        struct tm *gmtime (clock)
        long *clock;

        char *asctime (tm)
        struct tm *tm;

        extern long timezone;

        extern int daylight;

        extern char *tzname[2];

        void tzset ( )


        DESCRIPTION

        Ctime converts a long integer, pointed to by clock, representing
        the time in seconds since 00:00:00 GMT, January 1, 1970, and
        returns a pointer to a 26-character string in the following form.
        All the fields have constant width.

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

        Localtime and gmtime return pointers to tm structures, described
        below.  Localtime corrects for the time zone and possible
        Daylight Savings Time; gmtime converts directly to Greenwich Mean
        Time (GMT), which is the time the DG/UX system uses.

        Asctime converts a tm structure to a 26-character string, as
        shown in the above example, and returns a pointer to the string.

        Declarations of all the functions and externals, and the tm
        structure, are in the <time.h> header file.  The structure
        declaration is:



        DG/UX 4.00                                                 Page 1
               Licensed material--property of copyright holder(s)





                                                                ctime(3c)



             struct tm {
                     int tm_sec; /* seconds (0 - 59) */
                     int tm_min; /* minutes (0 - 59) */
                     int tm_hour;     /* hours (0 - 23) */
                     int tm_mday;     /* day of month (1 - 31) */
                     int tm_mon;      /* month of year (0 - 11) */
                     int tm_year;     /* year - 1900 */
                     int tm_wday;     /* day of week (Sunday = 0) */
                     int tm_yday;     /* day of year (0 - 365) */
                     int tm_isdst;
             };

        Tm_isdst is non-zero if Daylight Savings Time is in effect.

        The external long variable timezone contains the difference, in
        seconds, between GMT and local standard time (in EST, timezone is
        5*60*60); the external variable daylight is non-zero if and only
        if the standard U.S.A.  Daylight Savings Time conversion should
        be applied.  The program knows about the peculiarities of this
        conversion in 1974 and 1975; if necessary, a table for these
        years can be extended.

        If an environment variable named TZ is present, asctime uses the
        contents of the variable to override the default time zone.  The
        value of TZ must be a three-letter time zone name, followed by a
        number representing the difference between local time and
        Greenwich Mean Time in hours, followed by an optional three-
        letter name for a daylight time zone.  For example, the setting
        for New Jersey would be EST5EDT.  Thus, setting TZ changes the
        values of the external variables timezone and daylight; in
        addition, the time zone names contained in the external variable:

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

        are set from the environment variable TZ.  The function tzset
        sets these external variables from TZ; tzset is called by
        asctime.  The user can also call it.

        Note that in most installations, TZ is set by default when the
        user logs on, to a value in the local /etc/profile file (see
        profile(4)).

        Time(2) is quite useful for producing the values with which to
        call ctime(3C).


        SEE ALSO

        time(2), getenv(3C), profile(4), environ(5).





        DG/UX 4.00                                                 Page 2
               Licensed material--property of copyright holder(s)





                                                                ctime(3c)



        Caveat

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


















































        DG/UX 4.00                                                 Page 3
               Licensed material--property of copyright holder(s)



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