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

FreeBSD Manual Pages

  
 
  

home | help
KHTTP_EPOCH2STR(3)	     Library Functions Manual	      KHTTP_EPOCH2STR(3)

NAME
     khttp_epoch2str, khttp_epoch2ustr -- convert time to a string

LIBRARY
     libkcgi

SYNOPSIS
     #include <sys/types.h>
     #include <stdarg.h>
     #include <stdint.h>
     #include <kcgi.h>

     char *
     khttp_epoch2str(int64_t epoch, char *buf, size_t sz);

     char *
     khttp_epoch2ustr(int64_t epoch, char *buf, size_t sz);

DESCRIPTION
     Format  an  epoch	value (seconds since Jan 1, 1970, 00:00:00 UTC) into the
     buffer buf of size sz, which should be greater than or equal to  64  bytes.
     If  not  enough  space is given for the formatted date, the buffer is trun-
     cated to the available size.  It is always NUL-terminated.

     The output of khttp_epoch2str() conforms to RFC 5322  ("Wed,  02  Oct  2002
     13:00:00  GMT").  However, the year may be greater than four digits or less
     than 1900, or even be negative, which is contrary to RFC 5322 section 3.3.

     khttp_epoch2ustr() conforms to  ISO  8601	("2002-10-02T13:00:00Z"),  again
     with  the stipulation that the year may be greater than 4 digits or be less
     than zero.

     These deprecate the  original  kutil_epoch2str()  and  kutil_epoch2utcstr()
     functions, which had undefined behaviour in some corner cases.

RETURN VALUES
     Returns  a  pointer to the input buf or NULL if buf is NULL, sz is zero, or
     time conversion fails.

SEE ALSO
     khttp_datetime2epoch(3), khttp_epoch2datetime(3), khttp_epoch2tms(3)

AUTHORS
     Written by Kristaps Dzonsons <kristaps@bsd.lv>.

FreeBSD ports 15.quarterly	   $Mdocdate$		      KHTTP_EPOCH2STR(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=khttp_epoch2str&sektion=3&manpath=FreeBSD+Ports+15.1.quarterly>

home | help