CTIME man page on Plan9

Printed from http://www.polarhome.com/service/man/?qf=CTIME&af=0&tf=2&of=Plan9

CTIME(2)							      CTIME(2)

NAME
       ctime,  localtime, gmtime, asctime, tm2sec, timezone - convert date and
       time

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

       char* ctime(long clock)

       Tm*   localtime(long clock)

       Tm*   gmtime(long clock)

       char* asctime(Tm *tm)

       long  tm2sec(Tm *tm)

       /env/timezone

DESCRIPTION
       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  bro‐
       ken-down	 time.	Localtime corrects for the time zone and possible day‐
       light savings time; gmtime converts directly to GMT.  Asctime  converts
       a broken-down time to ASCII and returns a pointer to a 30-byte string.

	      typedef
	      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 */
		    int	 tzoff;	     /* time zone delta from GMT */
	      } Tm;

       Tm2sec  converts	 a  broken-down time to seconds since the start of the
       epoch.  It ignores wday, and assumes the local time zone if zone is not
       GMT.

       When  local  time is first requested, the program consults the timezone
       environment variable to determine the time zone	and  converts  accord‐
       ingly.	(This  variable	 is  set at system boot time by init(8).)  The
       timezone variable contains the normal time zone name and its difference
       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 example:

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

       Greenwich Mean Time is represented by

	      GMT 0

SOURCE
       /sys/src/libc/9sys

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

BUGS
       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 pro‐
       vincial anyway.

								      CTIME(2)
[top]
                             _         _         _ 
                            | |       | |       | |     
                            | |       | |       | |     
                         __ | | __ __ | | __ __ | | __  
                         \ \| |/ / \ \| |/ / \ \| |/ /  
                          \ \ / /   \ \ / /   \ \ / /   
                           \   /     \   /     \   /    
                            \_/       \_/       \_/ 
More information is available in HTML format for server Plan9

List of man pages available for Plan9

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net