w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

localtime.c File Reference
#include "private.h"
#include "tzfile.h"
#include "fcntl.h"
Include dependency graph for localtime.c:

Go to the source code of this file.

Classes

struct  ttinfo
 
struct  lsinfo
 
struct  state
 
struct  rule
 

Macros

#define TZ_ABBR_MAX_LEN   16
 
#define TZ_ABBR_CHAR_SET    "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 :+-._"
 
#define TZ_ABBR_ERR_CHAR   '_'
 
#define OPEN_MODE   O_RDONLY
 
#define WILDABBR   " "
 
#define TZDEFRULESTRING   ",M4.1.0,M10.5.0"
 
#define BIGGEST(a, b)   (((a) > (b)) ? (a) : (b))
 
#define MY_TZNAME_MAX   255
 
#define JULIAN_DAY   0 /* Jn - Julian day */
 
#define DAY_OF_YEAR   1 /* n - day of year */
 
#define MONTH_NTH_DAY_OF_WEEK   2 /* Mm.n.d - month, week, day of week */
 
#define lclptr   (&lclmem)
 
#define gmtptr   (&gmtmem)
 
#define TZ_STRLEN_MAX   255
 
#define WRONG   (-1)
 

Functions

static int_fast32_t detzcode (const char *codep)
 
static int_fast64_t detzcode64 (const char *codep)
 
static int differ_by_repeat (time_t t1, time_t t0)
 
static const char * getzname (const char *strp)
 
static const char * getqzname (const char *strp, const int delim)
 
static const char * getnum (const char *strp, int *nump, int min, int max)
 
static const char * getsecs (const char *strp, int_fast32_t *secsp)
 
static const char * getoffset (const char *strp, int_fast32_t *offsetp)
 
static const char * getrule (const char *strp, struct rule *rulep)
 
static void gmtload (struct state *sp)
 
static struct tmgmtsub (const time_t *timep, int_fast32_t offset, struct tm *tmp)
 
static struct tmlocalsub (const time_t *timep, int_fast32_t offset, struct tm *tmp)
 
static int increment_overflow (int *number, int delta)
 
static int leaps_thru_end_of (int y)
 
static int increment_overflow32 (int_fast32_t *number, int delta)
 
static int increment_overflow_time (time_t *t, int_fast32_t delta)
 
static int normalize_overflow32 (int_fast32_t *tensptr, int *unitsptr, int base)
 
static int normalize_overflow (int *tensptr, int *unitsptr, int base)
 
static void settzname (void)
 
static time_t time1 (struct tm *tmp, struct tm *(*funcp)(const time_t *, int_fast32_t, struct tm *), int_fast32_t offset)
 
static time_t time2 (struct tm *tmp, struct tm *(*funcp)(const time_t *, int_fast32_t, struct tm *), int_fast32_t offset, int *okayp)
 
static time_t time2sub (struct tm *tmp, struct tm *(*funcp)(const time_t *, int_fast32_t, struct tm *), int_fast32_t offset, int *okayp, int do_norm_secs)
 
static struct tmtimesub (const time_t *timep, int_fast32_t offset, const struct state *sp, struct tm *tmp)
 
static int tmcomp (const struct tm *atmp, const struct tm *btmp)
 
static int_fast32_t transtime (int year, const struct rule *rulep, int_fast32_t offset)
 
static int typesequiv (const struct state *sp, int a, int b)
 
static int tzload (const char *name, struct state *sp, int doextend)
 
static int tzparse (const char *name, struct state *sp, int lastditch)
 
static int tzload (register const char *name, register struct state *const sp, register const int doextend)
 
static const char * getzname (register const char *strp)
 
static const char * getqzname (register const char *strp, const int delim)
 
static const char * getnum (register const char *strp, int *const nump, const int min, const int max)
 
static const char * getsecs (register const char *strp, int_fast32_t *const secsp)
 
static const char * getoffset (register const char *strp, int_fast32_t *const offsetp)
 
static const char * getrule (const char *strp, register struct rule *const rulep)
 
static int_fast32_t transtime (const int year, register const struct rule *const rulep, const int_fast32_t offset)
 
static int tzparse (const char *name, register struct state *const sp, const int lastditch)
 
static void tzsetwall (void)
 
void tzset (void)
 
struct tmlocaltime (const time_t *const timep)
 
struct tmlocaltime_r (const time_t *const timep, struct tm *tmp)
 
struct tmgmtime (const time_t *const timep)
 
struct tmgmtime_r (const time_t *const timep, struct tm *tmp)
 
static int leaps_thru_end_of (register const int y)
 
static struct tmtimesub (const time_t *const timep, const int_fast32_t offset, register const struct state *const sp, register struct tm *const tmp)
 
char * ctime (const time_t *const timep)
 
char * ctime_r (const time_t *const timep, char *buf)
 
static int tmcomp (register const struct tm *const atmp, register const struct tm *const btmp)
 
time_t mktime (struct tm *const tmp)
 

Variables

static const char wildabbr [] = " "
 
static const char gmt [] = "GMT"
 
static struct state lclmem
 
static struct state gmtmem
 
static char lcl_TZname [255+1]
 
static int lcl_is_set
 
static int gmt_is_set
 
char * tzname [2]
 
static struct tm tm
 
static const int mon_lengths [2][12]
 
static const int year_lengths [2]
 

Macro Definition Documentation

◆ BIGGEST

#define BIGGEST (   a,
  b 
)    (((a) > (b)) ? (a) : (b))

Definition at line 92 of file localtime.c.

◆ DAY_OF_YEAR

#define DAY_OF_YEAR   1 /* n - day of year */

Definition at line 126 of file localtime.c.

◆ gmtptr

#define gmtptr   (&gmtmem)

Definition at line 192 of file localtime.c.

◆ JULIAN_DAY

#define JULIAN_DAY   0 /* Jn - Julian day */

Definition at line 125 of file localtime.c.

◆ lclptr

#define lclptr   (&lclmem)

Definition at line 191 of file localtime.c.

◆ MONTH_NTH_DAY_OF_WEEK

#define MONTH_NTH_DAY_OF_WEEK   2 /* Mm.n.d - month, week, day of week */

Definition at line 127 of file localtime.c.

◆ MY_TZNAME_MAX

#define MY_TZNAME_MAX   255

Definition at line 98 of file localtime.c.

◆ OPEN_MODE

#define OPEN_MODE   O_RDONLY

Definition at line 38 of file localtime.c.

◆ TZ_ABBR_CHAR_SET

#define TZ_ABBR_CHAR_SET    "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 :+-._"

Definition at line 22 of file localtime.c.

◆ TZ_ABBR_ERR_CHAR

#define TZ_ABBR_ERR_CHAR   '_'

Definition at line 27 of file localtime.c.

◆ TZ_ABBR_MAX_LEN

#define TZ_ABBR_MAX_LEN   16

Definition at line 18 of file localtime.c.

◆ TZ_STRLEN_MAX

#define TZ_STRLEN_MAX   255

Definition at line 196 of file localtime.c.

◆ TZDEFRULESTRING

#define TZDEFRULESTRING   ",M4.1.0,M10.5.0"

Definition at line 76 of file localtime.c.

◆ WILDABBR

#define WILDABBR   " "

Definition at line 61 of file localtime.c.

◆ WRONG

#define WRONG   (-1)

Definition at line 1574 of file localtime.c.

Function Documentation

◆ ctime()

char* ctime ( const time_t *const  timep)

Definition at line 1545 of file localtime.c.

References asctime(), and localtime().

◆ ctime_r()

char* ctime_r ( const time_t *const  timep,
char *  buf 
)

Definition at line 1557 of file localtime.c.

References asctime_r(), buf, localtime_r(), and tm.

◆ detzcode()

static int_fast32_t detzcode ( const char *  codep)
static

Definition at line 228 of file localtime.c.

References i, and check-static-inits::result.

Referenced by tzload().

◆ detzcode64()

static int_fast64_t detzcode64 ( const char *  codep)
static

Definition at line 240 of file localtime.c.

References i, and check-static-inits::result.

Referenced by tzload().

◆ differ_by_repeat()

static int differ_by_repeat ( time_t  t1,
time_t  t0 
)
static

Definition at line 316 of file localtime.c.

References SECSPERREPEAT, SECSPERREPEAT_BITS, t0, t1, TYPE_BIT, and TYPE_SIGNED.

Referenced by tzload().

◆ getnum() [1/2]

static const char* getnum ( const char *  strp,
int nump,
int  min,
int  max 
)
static

Referenced by getrule(), and getsecs().

◆ getnum() [2/2]

static const char* getnum ( register const char *  strp,
int *const  nump,
const int  min,
const int  max 
)
static

Definition at line 686 of file localtime.c.

References c, is_digit, max, min, NULL, and num.

◆ getoffset() [1/2]

static const char* getoffset ( const char *  strp,
int_fast32_t offsetp 
)
static

Referenced by getrule(), and tzparse().

◆ getoffset() [2/2]

static const char* getoffset ( register const char *  strp,
int_fast32_t *const  offsetp 
)
static

Definition at line 755 of file localtime.c.

References getsecs(), and NULL.

◆ getqzname() [1/2]

static const char* getqzname ( const char *  strp,
const int  delim 
)
static

Referenced by tzparse().

◆ getqzname() [2/2]

static const char* getqzname ( register const char *  strp,
const int  delim 
)
static

Definition at line 669 of file localtime.c.

References c, and delim.

◆ getrule() [1/2]

static const char* getrule ( const char *  strp,
register struct rule *const  rulep 
)
static

◆ getrule() [2/2]

static const char* getrule ( const char *  strp,
struct rule rulep 
)
static

Referenced by tzparse().

◆ getsecs() [1/2]

static const char* getsecs ( const char *  strp,
int_fast32_t secsp 
)
static

Referenced by getoffset().

◆ getsecs() [2/2]

static const char* getsecs ( register const char *  strp,
int_fast32_t *const  secsp 
)
static

Definition at line 715 of file localtime.c.

References DAYSPERWEEK, getnum(), HOURSPERDAY, int_fast32_t, MINSPERHOUR, NULL, num, SECSPERHOUR, and SECSPERMIN.

◆ getzname() [1/2]

static const char* getzname ( const char *  strp)
static

Referenced by tzparse().

◆ getzname() [2/2]

static const char* getzname ( register const char *  strp)
static

Definition at line 649 of file localtime.c.

References c, and is_digit.

◆ gmtime()

◆ gmtime_r()

struct tm* gmtime_r ( const time_t *const  timep,
struct tm tmp 
)

Definition at line 1389 of file localtime.c.

References gmtsub(), and L.

◆ gmtload()

static void gmtload ( struct state sp)
static

Definition at line 1168 of file localtime.c.

References gmt, sp, TRUE, tzload(), tzparse(), and void.

Referenced by gmtsub(), tzset(), and tzsetwall().

◆ gmtsub()

static struct tm * gmtsub ( const time_t timep,
int_fast32_t  offset,
struct tm tmp 
)
static

Definition at line 1353 of file localtime.c.

References gmt, gmt_is_set, gmtload(), gmtptr, malloc, NULL, offset, check-static-inits::result, timesub(), tm, TRUE, and wildabbr.

Referenced by gmtime(), gmtime_r(), and localsub().

◆ increment_overflow()

static int increment_overflow ( int number,
int  delta 
)
static

Definition at line 1582 of file localtime.c.

References FALSE, i, INT_MAX, INT_MIN, ip, j, and TRUE.

Referenced by normalize_overflow(), time2sub(), and timesub().

◆ increment_overflow32()

static int increment_overflow32 ( int_fast32_t number,
int  delta 
)
static

Definition at line 1599 of file localtime.c.

References FALSE, INT_FAST32_MAX, INT_FAST32_MIN, cutout::l, lp, m, and TRUE.

Referenced by normalize_overflow32(), and time2sub().

◆ increment_overflow_time()

static int increment_overflow_time ( time_t t,
int_fast32_t  delta 
)
static

Definition at line 1610 of file localtime.c.

References FALSE, j, time_t_max, time_t_min, tp, TRUE, and TYPE_SIGNED.

Referenced by tzparse().

◆ leaps_thru_end_of() [1/2]

static int leaps_thru_end_of ( int  y)
static

Referenced by leaps_thru_end_of(), and timesub().

◆ leaps_thru_end_of() [2/2]

static int leaps_thru_end_of ( register const int  y)
static

Definition at line 1410 of file localtime.c.

References leaps_thru_end_of(), and y.

◆ localsub()

static struct tm * localsub ( const time_t timep,
int_fast32_t  offset,
struct tm tmp 
)
static

◆ localtime()

◆ localtime_r()

struct tm* localtime_r ( const time_t *const  timep,
struct tm tmp 
)

Definition at line 1343 of file localtime.c.

References L, and localsub().

Referenced by ctime_r().

◆ mktime()

◆ normalize_overflow()

static int normalize_overflow ( int tensptr,
int unitsptr,
int  base 
)
static

Definition at line 1626 of file localtime.c.

References base, and increment_overflow().

Referenced by time2sub().

◆ normalize_overflow32()

static int normalize_overflow32 ( int_fast32_t tensptr,
int unitsptr,
int  base 
)
static

Definition at line 1638 of file localtime.c.

References base, and increment_overflow32().

Referenced by time2sub().

◆ settzname()

◆ time1()

static time_t time1 ( struct tm tmp,
struct tm *(*)(const time_t *, int_fast32_t, struct tm *)  funcp,
int_fast32_t  offset 
)
static

Definition at line 1860 of file localtime.c.

References errno, FALSE, gmtptr, i, lclptr, localsub(), NULL, offset, sp, t, time2(), TRUE, TZ_MAX_TYPES, and WRONG.

Referenced by mktime().

◆ time2()

static time_t time2 ( struct tm tmp,
struct tm *(*)(const time_t *, int_fast32_t, struct tm *)  funcp,
int_fast32_t  offset,
int okayp 
)
static

Definition at line 1843 of file localtime.c.

References FALSE, offset, t, time2sub(), and TRUE.

Referenced by time1().

◆ time2sub()

◆ timesub() [1/2]

static struct tm* timesub ( const time_t *const  timep,
const int_fast32_t  offset,
register const struct state *const  sp,
register struct tm *const  tmp 
)
static

◆ timesub() [2/2]

static struct tm* timesub ( const time_t timep,
int_fast32_t  offset,
const struct state sp,
struct tm tmp 
)
static

Referenced by gmtsub(), and localsub().

◆ tmcomp() [1/2]

static int tmcomp ( const struct tm atmp,
const struct tm btmp 
)
static

Referenced by time2sub().

◆ tmcomp() [2/2]

static int tmcomp ( register const struct tm *const  atmp,
register const struct tm *const  btmp 
)
static

Definition at line 1651 of file localtime.c.

References check-static-inits::result.

◆ transtime() [1/2]

static int_fast32_t transtime ( const int  year,
register const struct rule *const  rulep,
const int_fast32_t  offset 
)
static

◆ transtime() [2/2]

static int_fast32_t transtime ( int  year,
const struct rule rulep,
int_fast32_t  offset 
)
static

Referenced by tzparse().

◆ typesequiv()

static int typesequiv ( const struct state sp,
int  a,
int  b 
)
static

Definition at line 612 of file localtime.c.

References a, ap, b, bp, FALSE, NULL, check-static-inits::result, sp, and strcmp().

Referenced by tzload().

◆ tzload() [1/2]

static int tzload ( const char *  name,
struct state sp,
int  doextend 
)
static

Referenced by gmtload(), tzparse(), tzset(), and tzsetwall().

◆ tzload() [2/2]

◆ tzparse() [1/2]

◆ tzparse() [2/2]

static int tzparse ( const char *  name,
struct state sp,
int  lastditch 
)
static

Referenced by gmtload(), tzload(), and tzset().

◆ tzset()

void tzset ( void  )

◆ tzsetwall()

static void tzsetwall ( void  )
static

Definition at line 1182 of file localtime.c.

References gmtload(), lcl_is_set, lclptr, malloc, NULL, settzname(), TRUE, and tzload().

Referenced by tzset().

Variable Documentation

◆ gmt

const char gmt[] = "GMT"
static

Definition at line 66 of file localtime.c.

Referenced by dumptimeICU(), gmtload(), gmtsub(), make_asn1_date(), makepdftime(), settzname(), and tzset().

◆ gmt_is_set

int gmt_is_set
static

Definition at line 201 of file localtime.c.

Referenced by gmtsub().

◆ gmtmem

struct state gmtmem
static

Definition at line 180 of file localtime.c.

◆ lcl_is_set

int lcl_is_set
static

Definition at line 200 of file localtime.c.

Referenced by tzset(), and tzsetwall().

◆ lcl_TZname

char lcl_TZname[255+1]
static

Definition at line 199 of file localtime.c.

Referenced by tzset().

◆ lclmem

struct state lclmem
static

Definition at line 180 of file localtime.c.

◆ mon_lengths

const int mon_lengths[2][12]
static
Initial value:
= {
{ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
{ 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
}

Definition at line 633 of file localtime.c.

Referenced by time2sub(), timesub(), and transtime().

◆ tm

struct tm tm
static

Definition at line 203 of file localtime.c.

Referenced by _cairo_pdf_interchange_set_create_date(), _cairo_win32_printing_surface_acquire_image_pattern(), _zzip_ctime(), AddSpline(), aes_encode_mix(), asn_date(), buffer_get(), buffer_init(), call_binTM(), check_macbinary(), CheckFAccess(), checkseed(), ClearCW(), cmsGetHeaderCreationDateTime(), compute_timezone_offset(), ctime_r(), current_mrb_time(), cvt_unix_to_1904(), drvbase::DateString(), dateStringToTime(), GlobalParams::debugLogPrintf(), DefaultTTFEnglishNames(), dev_set_text_matrix(), do_time(), dpx_util_format_asn_date(), dumptimeICU(), dvi_init(), file_timestamp_sprintf(), fix_date_and_time(), funcnamefromcode(), GCTM(), get_date_and_time(), getInfoDate(), getLocalTimeZoneOffset(), getrandomseed(), global_select(), gmtime(), gmtime_r(), gmtsub(), hunt(), huntICU(), inet_tryaccept(), inet_tryconnect(), inet_trydisconnect(), IterateSplineSolveFixup(), lj_cf_os_date(), lj_cf_os_time(), Matrix::lmultiply(), localsub(), localtime(), localtime_r(), luaT_callbinTM(), luaT_gettm(), luaV_equalobj(), luaV_equalval(), luaV_finishget(), luaV_finishset(), luaV_gettable(), luaV_objlen(), luaV_settable(), main(), make_asn1_date(), makepdftime(), meth_accept(), meth_receive(), meth_receivefrom(), meth_send(), meth_sendto(), meth_setpeername(), mrb_time_asctime(), mrb_time_day(), mrb_time_dst_p(), mrb_time_getlocal(), mrb_time_getutc(), mrb_time_hour(), mrb_time_initialize(), mrb_time_localtime(), mrb_time_mday(), mrb_time_min(), mrb_time_minus(), mrb_time_mon(), mrb_time_plus(), mrb_time_sec(), mrb_time_to_f(), mrb_time_to_i(), mrb_time_to_s(), mrb_time_usec(), mrb_time_utc(), mrb_time_utc_p(), mrb_time_wday(), mrb_time_wrap(), mrb_time_yday(), mrb_time_year(), mrb_time_zone(), my_timgm(), os_date(), os_time(), OutChar(), OutputUserPrompt(), OutStr(), Matrix::parse(), parseInfoDate(), parseXMPDate(), png_convert_from_time_t(), print_pdf_matrix(), printInfoDate(), PS_Head(), Matrix::rmultiply(), sendraw(), sha1_process_block(), show(), socket_accept(), socket_connect(), socket_read(), socket_recv(), socket_recvfrom(), socket_select(), socket_send(), socket_sendto(), socket_waitfd(), socket_write(), time2sub(), time_alloc_time(), time_get_ptr(), time_mktime(), time_to_s_local(), time_to_s_utc(), time_update_datetime(), timegm(), timeout_get(), timeout_getretry(), timeout_getstart(), timeout_init(), timeout_markstart(), timeout_meth_gettimeout(), timeout_meth_settimeout(), TimeStamp(), timeToDateString(), BoundingBox::transform(), tryfuncTM(), Type_DateTime_Dup(), Type_DateTime_Read(), Type_DateTime_Write(), ucm_addMapping(), UnDefineChars(), UnDefineCharsW(), UnDefineStr(), uprv_timezone_68(), uprv_tzname_68(), usrc_createWithHeader(), write_pre(), write_tiff(), zzip_disk_entry_get_mktime(), and drvPDF::~drvPDF().

◆ tzname

char* tzname[2]
Initial value:
= {
(char *) wildabbr,
(char *) wildabbr
}
static const char wildabbr[]
Definition: localtime.c:64

Definition at line 203 of file localtime.c.

Referenced by abbr(), localsub(), and settzname().

◆ wildabbr

const char wildabbr[] = " "
static

Definition at line 64 of file localtime.c.

Referenced by gmtsub(), and settzname().

◆ year_lengths

const int year_lengths[2]
static
Initial value:
= {
365 , 366
}

Definition at line 638 of file localtime.c.

Referenced by time2sub(), timesub(), and tzparse().