Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

time(2)

profile(4)

CFTIME(3X)                           SysV                           CFTIME(3X)



NAME
     cftime, ascftime - convert date and time to string

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

     int cftime (buf, fmt, clock)
     char *buf;
     const char *fmt;
     time_t *clock;

     int ascftime (buf, fmt, tm)
     char *buf;
     const char *fmt;
     struct tm *tm

DESCRIPTION
     cftime and ascftime are obsoleted by the ANSI C strftime(3c) function. We
     strongly recommend that you use strftime(3c) in place of cftime and
     ascftime.

     The cftime function takes an integer of type time_t pointed to by clock
     and converts it to a character string.  ascftime takes a pointer to a tm
     structure and converts it to a character string.  In both functions, the
     characters are placed into the array pointed to by buf (plus a
     terminating \0) and the value returned is the number of such characters
     (not counting the terminating \0).  fmt controls the format of the
     resulting string.

     fmt is a character string that consists of field descriptors and text
     characters, reminiscent of print(3S).  Each field descriptor consists of
     a % character followed by another character which specifies the
     replacement for the field descriptor.  All other characters are copied
     from fmt into the result.

     cftime, and ascftime all support the following field descriptors:

          %%   Same as %
          %a   Abbreviated weekday name
          %A   Full weekday name
          %b   Abbreviated month name
          %B   Full month name
          %d   Day of month (01-31)
          %H   Hour (00-23)
          %I   Hour (00-12)
          %j   Day number of year (001-366)
          %m   Month number (01-12)
          %M   Minute (00-59)
          %p   Ante meridian or post meridian
          %S   Seconds (00-59)
          %U   Week number of year (01-52); Sunday is the first day of week
          %w   Weekday number (Sunday=0)
          %W   Week number of year (01-52); Monday is the first day of week
          %x   Local specific date format
          %X   Local specific time format
          %y   Year within century (00-99)
          %Y   Year as ccyy (for example, 1988)
          %Z   Time zone name
          %D   Date as %m/%d/%y
          %e   Day of month (1-31; single digits are preceded by a blank)
          %h   Abbreviated month name
          %n   Same as \n
          %r   Time as %I:%M:%S %p
          %R   Time as %H:%M
          %t   Insert tab
          %T   Time as %H:%M:%S

     For the purposes of %U and %W, cftime and ascftime consider week number
     01 to be the first week with four or more January days in it.

     If fmt is (char *)0, cftime and ascftime use the value of the environment
     variable CFTIME.  If CFTIME is undefined or empty, a default format is
     used.  The default format string is taken from the file in /lib/cftime
     (see cftime(4)) that contains the date and time strings associated with
     the current language.

     Setting the environment variable LANGUAGE to the name of a file in
     /usr/lib/cftime causes cftime and ascftime to default to the format
     specified by the contents of that file if CFTIME is undefined or empty.
     If LANGUAGE is also undefined, empty, or set to an unsupported language,
     the last language requested will be used (the default is usa_english).

FILES
     Directory for language-specific format files:
          /usr/lib/cftime

     Language-specific format files:

     /usr/lib/cftime/danish
     /usr/lib/cftime/finnish
     /usr/lib/cftime/french
     /usr/lib/cftime/german
     /usr/lib/cftime/italian
     /usr/lib/cftime/norwegian
     /usr/lib/cftime/spanish
     /usr/lib/cftime/swedish
     /usr/lib/cftime/usa_english

SEE ALSO
     time(2), profile(4),

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