Unix/Linux Go Back    

Plan 9 - man page for ctime (plan9 section 2)

Linux & Unix Commands - Search Man Pages
Man Page or Keyword Search:   man
Select Man Page Set:       apropos Keyword Search (sections above)

CTIME(2)										 CTIME(2)

       ctime, localtime, gmtime, asctime, timezone - convert date and time to ASCII

       #include <u.h>
       #include <libc.h>

       char* ctime(long clock)

       Tm*   localtime(long clock)

       Tm*   gmtime(long clock)

       char* asctime(Tm *tm)


       Ctime  converts	a  time  clock such as returned by time(2) into ASCII (sic) and returns a
       pointer to a 30-byte string in the following form.  All the fields have constant width.

	     Wed Aug  5 01:07:47 EST 1973\n\0

       Localtime and gmtime return  pointers  to  structures  containing  the  broken-down  time.
       Localtime  corrects  for the time zone and possible daylight savings time; gmtime converts
       directly to GMT.  Asctime converts a broken-down time to ASCII and returns a pointer to	a
       30-byte string.

	      struct {
		    int  sec;	     /* seconds (range 0..59) */
		    int  min;	     /* minutes (0..59) */
		    int  hour;	     /* hours (0..23) */
		    int  mday;	     /* day of the month (1..31) */
		    int  mon;	     /* month of the year (0..11) */
		    int  year;	     /* year A.D. - 1900 */
		    int  wday;	     /* day of week (0..6, Sunday = 0) */
		    int  yday;	     /* day of year (0..365) */
		    char zone[4];    /* time zone name */
	      } Tm;

       When local time is first requested, the program consults the timezone environment variable
       to determine the time zone and converts accordingly.  (This variable is set at system boot
       time  by  init(8).)  The timezone variable contains the normal time zone name and its dif-
       ference from GMT in seconds followed by an alternate (daylight) time  zone  name  and  its
       difference followed by a newline.  The remainder is a list of pairs of times (seconds past
       the start of 1970, in the first time zone) when the  alternate  time  zone  applies.   For

	      EST -18000 EDT -14400
	       9943200 25664400 41392800 57718800 ...

       Greenwich Mean Time is represented by

	      GMT 0


       date(1), time(2), init(8)

       The return values point to static data whose content is overwritten by each call.
       Daylight Savings Time is ``normal'' in the Southern hemisphere.
       These routines are not equipped to handle non-ASCII text, and are provincial anyway.

Unix & Linux Commands & Man Pages : 2000 - 2018 Unix and Linux Forums

All times are GMT -4. The time now is 12:53 PM.