Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
ctime(3C)							     ctime(3C)

NAME
       ctime(),	 ctime_r(),  localtime(), localtime_r(), gmtime(), gmtime_r(),
       mktime(), difftime(), asctime(),	asctime_r(),  timezone(),  daylight(),
       tzname(), tzset() - convert date	and time to string

SYNOPSIS
DESCRIPTION
       Convert the broken-down time contained in the structure pointed to by
			 timeptr and return a pointer to a 26-character	string
			 in the	form:

			 All the fields	have constant width.

			 returns NULL and sets errno to	if tm_year in is  less
			 than  0  or is	greater	than 8099.  In both 32-bit and
			 64-bit	HP-UX, the minimum date	supported by is	 Janu-
			 ary 1 00:00:00	1900 and the maximum date supported by
			 is December 31	23:59:59 9999.

       is identical to	 except	that it	places the result in the user supplied
			 and  returns  a  pointer  to  upon success.  A	buffer
			 length	of at least 26 is required.

       Convert the calendar time pointed to by
			 timer,	representing the time  in  seconds  since  the
			 Epoch,	 and return a pointer to the local time	in the
			 form of a string.  Equivalent to:

			 The minimum date supported  by	 in  both  32-bit  and
			 64-bit	HP-UX is Friday	December 13 20:45:52 UTC 1901.
			 The maximum dates supported by	are Tuesday January 19
			 03:14:07 UTC 2038 and Friday December 31 23:59:59 UTC
			 9999 in 32-bit	HP-UX and 64-bit HP-UX,	respectively.

			 In 64-bit HP-UX, returns NULL and sets	 errno	to  if
			 timer	is less	than the number	of seconds that	corre-
			 sponds	to the minimum date supported  (i.e.,  as  de-
			 fined in or exceeds the number	of seconds that	corre-
			 sponds	to the maximum date supported.

       is identical to	 except	that it	places the result in the user supplied
			 and  returns  a  pointer  to  upon success.  A	buffer
			 length	of at least 26 is required.

       Convert directly	to Coordinated Universal Time (UTC),
			 the time standard used	by the HP-UX operating system.
			 returns a pointer to the structure described below.

			 The  minimum  date  supported	by  in both 32-bit and
			 64-bit	HP-UX is Friday	December 13 20:45:52 UTC 1901.
			 The maximum dates supported by	are Tuesday January 19
			 03:14:07 UTC 2038 and Friday December 31 23:59:59 UTC
			 9999 in 32-bit	HP-UX and 64-bit HP-UX,	respectively.

			 In  64-bit  HP-UX,  returns NULL and sets errno to if
			 timer is less than the	number of seconds that	corre-
			 sponds	 to  the  minimum date supported (i.e.,	as de-
			 fined in or exceeds the number	of seconds that	corre-
			 sponds	to the maximum date supported.

       is identical to	 except	 that  stores  the result in the pointed to by
			 and returns upon success.

       Correct for the time zone and any summer	time zone adjustments
			 (such as Daylight Savings Time	in the USA), according
			 to  the  contents of the TZ environment variable (see
			 Environment Variables below).	returns	a  pointer  to
			 the structure described below.

			 The  minimum  date  supported	by  in both 32-bit and
			 64-bit	HP-UX is Friday	December 13 20:45:52 UTC 1901.
			 The maximum dates supported by	are Tuesday January 19
			 03:14:07 UTC 2038 and Friday December 31 23:59:59 UTC
			 9999 in 32-bit	HP-UX and 64-bit HP-UX,	respectively.

			 In  64-bit  HP-UX,  returns NULL and sets errno to if
			 timer is less than the	number of seconds that	corre-
			 sponds	 to  the  minimum date supported (i.e.,	as de-
			 fined in or exceeds the number	of seconds that	corre-
			 sponds	to the maximum date supported.

       is identical to	 except	 that  stores  the result in the pointed to by
			 and returns upon success.

       Return the difference in	seconds	between	two calendar times:
			 time1 - time0.

       Convert the broken-down time (expressed as local	time)
			 in the	structure pointed to by	timeptr	into a	calen-
			 dar  time value with the same encoding	as that	of the
			 values	returned by time(2).  The original  values  of
			 the  and components of	the structure are ignored, and
			 the original values of	the other components  are  not
			 restricted to the ranges indicated below.

			 A positive or zero value for causes to	initially pre-
			 sume that Daylight Saving Time	respectively is	or  is
			 not  in  effect  for  the specified time.  A negative
			 value for causes to attempt to	determine whether Day-
			 light	Saving	Time  is  in  effect for the specified
			 time.

			 Upon successful completion, all  the  components  are
			 set  to  represent  the  specified calendar time, but
			 with their values forced to the ranges	indicated  be-
			 low.  The final value of is not set until and are de-
			 termined.  returns the	specified  calendar  time  en-
			 coded as a value of type

			 If the	calendar time cannot be	represented, the func-
			 tion returns the value	and sets  to  Note  the	 value
			 also corresponds to the time 23:59:59 on Dec 31, 1969
			 (plus or minus	time zone and Daylight Saving Time ad-
			 justments).   Thus  it	is necessary to	check both the
			 return	value and to reliably detect an	 error	condi-
			 tion.

       Sets the	values of the external variables
			 timezone,  daylight, and tzname according to the con-
			 tents of the environment variable (independent	of any
			 time  value).	 The  functions	and (see strftime(3C))
			 call and use the  values  returned  in	 the  external
			 variables  described below for	their operations.  can
			 also be called	directly by the	user.

			 When the environment variable is not set, checks  the
			 default file for the timezone value and sets timezone
			 values	based on that.	The file contains the timezone
			 value	used  by  when the environment variable	is not
			 set.  The format for the file is same as format with-
			 out  the  prefix  Please check	environ(5) for format.
			 The order of setting is as follows.

			 1) if the environment variable	is present,  it	 takes
			    precedence.

			 2) if	is not present,	then the value contained in is
			    used for the default.

			 3) if is not set then the default value is equivalent
			    to (Eastern	Standard Time) of the USA.

			 can  be modified for an appropriate default value for
			 timezone.

       The header file contains	declarations of	all relevant functions and ex-
       ternals.	  It also contains the structure, which	includes the following
       members:

	      int tm_sec;      /* seconds after	the minute - [0,61] */
	      int tm_min;      /* minutes after	the hour - [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;     /* years	since 1900 */
	      int tm_wday;     /* days since Sunday - [0,6] */
	      int tm_yday;     /* days since January 1 - [0,365] */
	      int tm_isdst;    /* daylight savings time	flag */

       The value of is positive	if a summer time zone adjustment such as  Day-
       light Savings Time is in	effect,	zero if	not in effect, and negative if
       the information is not available.

       The external variable contains the difference, in seconds, between  UTC
       and  local  standard  time  (for	example, in the	U.S. Eastern time zone
       (EST), is 5*60*60).  The	external variable is non-zero only if a	summer
       time  zone adjustment is	specified in the TZ environment	variable.  The
       external	variable contains the local standard  and  local  summer  time
       zone abbreviations as specified by the environment variable.

EXTERNAL INFLUENCES
   Locale
       The  category  determines the interpretation of the bytes within	format
       as single and/or	multi-byte characters.

   Environment Variables
       The function uses the contents of to set	the  values  of	 the  external
       variables  and  also  determines	the time zone name substituted for the
       and directives and the time zone	adjustments performed by and Two meth-
       ods for specifying a time zone within are described in environ(5).

   International Code Set Support
       Single- and multi-byte character	code sets are supported.

RETURN VALUE
       For and if the buffer is	of insufficient	length,	a NULL is returned and
       errno set to EINVAL.

       and return a NULL and set errno to EINVAL if NULL pointers  are	passed
       in as arguments.

       A  NULL	is  returned and errno is set to if the	input to the following
       routines	is not within the supported range:

APPLICATION USAGE
       The return values for and point to static data whose contents is	 over-
       written by each call.

WARNINGS
       Users  of  and  should  also  note  that	these functions	now conform to
       POSIX.1c. The old prototypes of these functions are supported for  com-
       patibility with existing	DCE applications only.

       The  range of extends to	61 to allow for	the occasional one or two leap
       seconds.	 However, the ``seconds	since the Epoch''  value  returned  by
       time(2)	and  passed as the timer argument does not include accumulated
       leap seconds.  The structure generated by and will  never  reflect  any
       leap seconds.  Upon successful completion, forces the value of the com-
       ponent to the range [0,59].

AUTHOR
       was developed by	AT&T and HP.

SEE ALSO
       time(2),	 getdate(3C),  setlocale(3C),  strftime(3C),  tztab(4),	 envi-
       ron(5), lang(5),	langinfo(5), thread_safety(5).

STANDARDS CONFORMANCE
								     ctime(3C)

NAME | SYNOPSIS | DESCRIPTION | EXTERNAL INFLUENCES | RETURN VALUE | APPLICATION USAGE | WARNINGS | AUTHOR | SEE ALSO | STANDARDS CONFORMANCE

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=ctime&sektion=3c&manpath=HP-UX+11.22>

home | help