Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
0a19fb42
Commit
0a19fb42
authored
May 21, 2004
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pgindent timezone file, per request from Tom.
parent
63bd0db1
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
2243 additions
and
1771 deletions
+2243
-1771
src/timezone/ialloc.c
src/timezone/ialloc.c
+19
-10
src/timezone/localtime.c
src/timezone/localtime.c
+563
-428
src/timezone/pgtz.c
src/timezone/pgtz.c
+77
-55
src/timezone/pgtz.h
src/timezone/pgtz.h
+3
-3
src/timezone/private.h
src/timezone/private.h
+26
-25
src/timezone/scheck.c
src/timezone/scheck.c
+16
-12
src/timezone/strftime.c
src/timezone/strftime.c
+370
-359
src/timezone/tzfile.h
src/timezone/tzfile.h
+34
-28
src/timezone/zic.c
src/timezone/zic.c
+1135
-851
No files found.
src/timezone/ialloc.c
View file @
0a19fb42
...
...
@@ -5,54 +5,63 @@
#define nonzero(n) (((n) == 0) ? 1 : (n))
char
*
imalloc
(
const
int
n
)
char
*
imalloc
(
const
int
n
)
{
return
malloc
((
size_t
)
nonzero
(
n
));
}
char
*
icalloc
(
int
nelem
,
int
elsize
)
char
*
icalloc
(
int
nelem
,
int
elsize
)
{
if
(
nelem
==
0
||
elsize
==
0
)
nelem
=
elsize
=
1
;
return
calloc
((
size_t
)
nelem
,
(
size_t
)
elsize
);
}
void
*
irealloc
(
void
*
pointer
,
const
int
size
)
void
*
irealloc
(
void
*
pointer
,
const
int
size
)
{
if
(
pointer
==
NULL
)
return
imalloc
(
size
);
return
realloc
((
void
*
)
pointer
,
(
size_t
)
nonzero
(
size
));
}
char
*
icatalloc
(
char
*
old
,
const
char
*
new
)
char
*
icatalloc
(
char
*
old
,
const
char
*
new
)
{
register
char
*
result
;
register
int
oldsize
,
newsize
;
register
char
*
result
;
register
int
oldsize
,
newsize
;
newsize
=
(
new
==
NULL
)
?
0
:
strlen
(
new
);
if
(
old
==
NULL
)
oldsize
=
0
;
else
if
(
newsize
==
0
)
return
old
;
else
oldsize
=
strlen
(
old
);
else
oldsize
=
strlen
(
old
);
if
((
result
=
irealloc
(
old
,
oldsize
+
newsize
+
1
))
!=
NULL
)
if
(
new
!=
NULL
)
(
void
)
strcpy
(
result
+
oldsize
,
new
);
return
result
;
}
char
*
icpyalloc
(
const
char
*
string
)
char
*
icpyalloc
(
const
char
*
string
)
{
return
icatalloc
((
char
*
)
NULL
,
string
);
}
void
ifree
(
char
*
p
)
void
ifree
(
char
*
p
)
{
if
(
p
!=
NULL
)
(
void
)
free
(
p
);
}
void
icfree
(
char
*
p
)
void
icfree
(
char
*
p
)
{
if
(
p
!=
NULL
)
(
void
)
free
(
p
);
...
...
src/timezone/localtime.c
View file @
0a19fb42
This diff is collapsed.
Click to expand it.
src/timezone/pgtz.c
View file @
0a19fb42
...
...
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/timezone/pgtz.c,v 1.1
0 2004/05/21 05:08:06 tgl
Exp $
* $PostgreSQL: pgsql/src/timezone/pgtz.c,v 1.1
1 2004/05/21 12:30:25 momjian
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -45,36 +45,46 @@ pg_TZDIR(void)
* set in our own library).
*/
#define T_YEAR (60*60*24*365)
#define T_MONTH
(60*60*24*30)
#define T_MONTH
(60*60*24*30)
struct
tztry
{
time_t
std_t
,
dst_t
;
char
std_time
[
TZ_STRLEN_MAX
+
1
],
dst_time
[
TZ_STRLEN_MAX
+
1
];
int
std_ofs
,
dst_ofs
;
struct
tm
std_tm
,
dst_tm
;
struct
tztry
{
time_t
std_t
,
dst_t
;
char
std_time
[
TZ_STRLEN_MAX
+
1
],
dst_time
[
TZ_STRLEN_MAX
+
1
];
int
std_ofs
,
dst_ofs
;
struct
tm
std_tm
,
dst_tm
;
};
static
bool
compare_tm
(
struct
tm
*
s
,
struct
pg_tm
*
p
)
{
if
(
s
->
tm_sec
!=
p
->
tm_sec
||
s
->
tm_min
!=
p
->
tm_min
||
s
->
tm_hour
!=
p
->
tm_hour
||
s
->
tm_mday
!=
p
->
tm_mday
||
s
->
tm_mon
!=
p
->
tm_mon
||
s
->
tm_year
!=
p
->
tm_year
||
s
->
tm_wday
!=
p
->
tm_wday
||
s
->
tm_yday
!=
p
->
tm_yday
||
static
bool
compare_tm
(
struct
tm
*
s
,
struct
pg_tm
*
p
)
{
if
(
s
->
tm_sec
!=
p
->
tm_sec
||
s
->
tm_min
!=
p
->
tm_min
||
s
->
tm_hour
!=
p
->
tm_hour
||
s
->
tm_mday
!=
p
->
tm_mday
||
s
->
tm_mon
!=
p
->
tm_mon
||
s
->
tm_year
!=
p
->
tm_year
||
s
->
tm_wday
!=
p
->
tm_wday
||
s
->
tm_yday
!=
p
->
tm_yday
||
s
->
tm_isdst
!=
p
->
tm_isdst
)
return
false
;
return
true
;
}
static
bool
try_timezone
(
char
*
tzname
,
struct
tztry
*
tt
,
bool
checkdst
)
{
static
bool
try_timezone
(
char
*
tzname
,
struct
tztry
*
tt
,
bool
checkdst
)
{
struct
pg_tm
*
pgtm
;
if
(
!
pg_tzset
(
tzname
))
return
false
;
/* If this timezone couldn't be picked at all */
return
false
;
/* If this timezone couldn't be picked at
* all */
/* Verify standard time */
pgtm
=
pg_localtime
(
&
(
tt
->
std_t
));
if
(
!
pgtm
)
...
...
@@ -95,7 +105,9 @@ static bool try_timezone(char *tzname, struct tztry *tt, bool checkdst) {
return
true
;
}
static
int
get_timezone_offset
(
struct
tm
*
tm
)
{
static
int
get_timezone_offset
(
struct
tm
*
tm
)
{
#if defined(HAVE_STRUCT_TM_TM_ZONE)
return
tm
->
tm_gmtoff
;
#elif defined(HAVE_INT_TIMEZONE)
...
...
@@ -113,12 +125,15 @@ static int get_timezone_offset(struct tm *tm) {
#ifdef WIN32
#define TZABBREV(tz) win32_get_timezone_abbrev(tz)
static
char
*
win32_get_timezone_abbrev
(
char
*
tz
)
{
static
char
w32tzabbr
[
TZ_STRLEN_MAX
+
1
];
int
l
=
0
;
char
*
c
;
static
char
*
win32_get_timezone_abbrev
(
char
*
tz
)
{
static
char
w32tzabbr
[
TZ_STRLEN_MAX
+
1
];
int
l
=
0
;
char
*
c
;
for
(
c
=
tz
;
*
c
;
c
++
)
{
for
(
c
=
tz
;
*
c
;
c
++
)
{
if
(
isupper
(
*
c
))
w32tzabbr
[
l
++
]
=
*
c
;
}
...
...
@@ -140,47 +155,50 @@ static char *win32_get_timezone_abbrev(char *tz) {
static
char
*
identify_system_timezone
(
void
)
{
static
char
__tzbuf
[
TZ_STRLEN_MAX
+
1
];
bool
std_found
=
false
,
dst_found
=
false
;
time_t
tnow
=
time
(
NULL
);
time_t
t
;
static
char
__tzbuf
[
TZ_STRLEN_MAX
+
1
];
bool
std_found
=
false
,
dst_found
=
false
;
time_t
tnow
=
time
(
NULL
);
time_t
t
;
struct
tztry
tt
;
char
cbuf
[
TZ_STRLEN_MAX
+
1
];
char
cbuf
[
TZ_STRLEN_MAX
+
1
];
/* Initialize OS timezone library */
tzset
();
memset
(
&
tt
,
0
,
sizeof
(
tt
));
for
(
t
=
tnow
;
t
<
tnow
+
T_YEAR
;
t
+=
T_MONTH
)
{
struct
tm
*
tm
=
localtime
(
&
t
);
if
(
tm
->
tm_isdst
==
0
&&
!
std_found
)
{
for
(
t
=
tnow
;
t
<
tnow
+
T_YEAR
;
t
+=
T_MONTH
)
{
struct
tm
*
tm
=
localtime
(
&
t
);
if
(
tm
->
tm_isdst
==
0
&&
!
std_found
)
{
/* Standard time */
memcpy
(
&
tt
.
std_tm
,
tm
,
sizeof
(
struct
tm
));
memset
(
cbuf
,
0
,
sizeof
(
cbuf
));
strftime
(
cbuf
,
sizeof
(
cbuf
)
-
1
,
"%Z"
,
tm
);
/* zone abbr */
memset
(
cbuf
,
0
,
sizeof
(
cbuf
));
strftime
(
cbuf
,
sizeof
(
cbuf
)
-
1
,
"%Z"
,
tm
);
/* zone abbr */
strcpy
(
tt
.
std_time
,
TZABBREV
(
cbuf
));
tt
.
std_ofs
=
get_timezone_offset
(
tm
);
tt
.
std_t
=
t
;
std_found
=
true
;
}
else
if
(
tm
->
tm_isdst
==
1
&&
!
dst_found
)
{
else
if
(
tm
->
tm_isdst
==
1
&&
!
dst_found
)
{
/* Daylight time */
memcpy
(
&
tt
.
dst_tm
,
tm
,
sizeof
(
struct
tm
));
memset
(
cbuf
,
0
,
sizeof
(
cbuf
));
strftime
(
cbuf
,
sizeof
(
cbuf
)
-
1
,
"%Z"
,
tm
);
/* zone abbr */
memset
(
cbuf
,
0
,
sizeof
(
cbuf
));
strftime
(
cbuf
,
sizeof
(
cbuf
)
-
1
,
"%Z"
,
tm
);
/* zone abbr */
strcpy
(
tt
.
dst_time
,
TZABBREV
(
cbuf
));
tt
.
dst_ofs
=
get_timezone_offset
(
tm
);
tt
.
dst_t
=
t
;
dst_found
=
true
;
}
if
(
std_found
&&
dst_found
)
break
;
/* Got both standard and daylight */
break
;
/* Got both standard and daylight */
}
if
(
!
std_found
)
if
(
!
std_found
)
{
/* Failed to determine TZ! */
ereport
(
LOG
,
...
...
@@ -189,24 +207,25 @@ identify_system_timezone(void)
return
NULL
;
/* go to GMT */
}
if
(
dst_found
)
{
if
(
dst_found
)
{
/* Try STD<ofs>DST */
sprintf
(
__tzbuf
,
"%s%d%s"
,
tt
.
std_time
,
-
tt
.
std_ofs
/
3600
,
tt
.
dst_time
);
sprintf
(
__tzbuf
,
"%s%d%s"
,
tt
.
std_time
,
-
tt
.
std_ofs
/
3600
,
tt
.
dst_time
);
if
(
try_timezone
(
__tzbuf
,
&
tt
,
dst_found
))
return
__tzbuf
;
}
/* Try just the STD timezone */
strcpy
(
__tzbuf
,
tt
.
std_time
);
if
(
try_timezone
(
__tzbuf
,
&
tt
,
dst_found
))
strcpy
(
__tzbuf
,
tt
.
std_time
);
if
(
try_timezone
(
__tzbuf
,
&
tt
,
dst_found
))
return
__tzbuf
;
/* Did not find the timezone. Fallback to try a GMT zone. */
sprintf
(
__tzbuf
,
"Etc/GMT%s%d"
,
(
-
tt
.
std_ofs
<
0
)
?
"+"
:
""
,
tt
.
std_ofs
/
3600
);
sprintf
(
__tzbuf
,
"Etc/GMT%s%d"
,
(
-
tt
.
std_ofs
<
0
)
?
"+"
:
""
,
tt
.
std_ofs
/
3600
);
ereport
(
LOG
,
(
errmsg
(
"could not recognize system timezone, defaulting to
\"
%s
\"
"
,
__tzbuf
),
errhint
(
"You can specify the correct timezone in postgresql.conf."
)));
(
errmsg
(
"could not recognize system timezone, defaulting to
\"
%s
\"
"
,
__tzbuf
),
errhint
(
"You can specify the correct timezone in postgresql.conf."
)));
return
__tzbuf
;
}
...
...
@@ -223,7 +242,7 @@ identify_system_timezone(void)
bool
tz_acceptable
(
void
)
{
struct
pg_tm
tt
;
struct
pg_tm
tt
;
time_t
time2000
;
/*
...
...
@@ -255,7 +274,7 @@ tz_acceptable(void)
const
char
*
select_default_timezone
(
void
)
{
char
*
def_tz
;
char
*
def_tz
;
def_tz
=
getenv
(
"TZ"
);
if
(
def_tz
&&
pg_tzset
(
def_tz
)
&&
tz_acceptable
())
...
...
@@ -280,9 +299,12 @@ select_default_timezone(void)
* This is called after initial loading of postgresql.conf. If no TimeZone
* setting was found therein, we try to derive one from the environment.
*/
void
pg_timezone_initialize
(
void
)
{
void
pg_timezone_initialize
(
void
)
{
/* Do we need to try to figure the timezone? */
if
(
strcmp
(
GetConfigOption
(
"timezone"
),
"UNKNOWN"
)
==
0
)
{
if
(
strcmp
(
GetConfigOption
(
"timezone"
),
"UNKNOWN"
)
==
0
)
{
const
char
*
def_tz
;
/* Select setting */
...
...
src/timezone/pgtz.h
View file @
0a19fb42
...
...
@@ -9,7 +9,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/timezone/pgtz.h,v 1.
7 2004/05/21 05:08:06 tgl
Exp $
* $PostgreSQL: pgsql/src/timezone/pgtz.h,v 1.
8 2004/05/21 12:30:25 momjian
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -18,6 +18,6 @@
#define TZ_STRLEN_MAX 255
extern
char
*
pg_TZDIR
(
void
);
extern
char
*
pg_TZDIR
(
void
);
#endif
/* _PGTZ_H */
#endif
/* _PGTZ_H */
src/timezone/private.h
View file @
0a19fb42
...
...
@@ -14,19 +14,19 @@
** Thank you!
*/
#include <limits.h>
/* for CHAR_BIT */
#include <sys/wait.h>
/* for WIFEXITED and WEXITSTATUS */
#include <unistd.h>
/* for F_OK and R_OK */
#include <limits.h>
/* for CHAR_BIT */
#include <sys/wait.h>
/* for WIFEXITED and WEXITSTATUS */
#include <unistd.h>
/* for F_OK and R_OK */
#include "pgtime.h"
#ifndef WIFEXITED
#define WIFEXITED(status) (((status) & 0xff) == 0)
#endif
/* !defined WIFEXITED */
#endif
/* !defined WIFEXITED */
#ifndef WEXITSTATUS
#define WEXITSTATUS(status)
(((status) >> 8) & 0xff)
#endif
/* !defined WEXITSTATUS */
#define WEXITSTATUS(status)
(((status) >> 8) & 0xff)
#endif
/* !defined WEXITSTATUS */
/* Unlike <ctype.h>'s isdigit, this also works if c < 0 | c > UCHAR_MAX. */
#define is_digit(c) ((unsigned)(c) - '0' <= 9)
...
...
@@ -37,7 +37,7 @@
#ifndef EXIT_SUCCESS
#define EXIT_SUCCESS 0
#endif
/* !defined EXIT_SUCCESS */
#endif
/* !defined EXIT_SUCCESS */
/*
** SunOS 4.1.1 headers lack EXIT_FAILURE.
...
...
@@ -45,28 +45,29 @@
#ifndef EXIT_FAILURE
#define EXIT_FAILURE 1
#endif
/* !defined EXIT_FAILURE */
#endif
/* !defined EXIT_FAILURE */
/*
** SunOS 4.1.1 libraries lack remove.
*/
#ifndef remove
extern
int
unlink
(
const
char
*
filename
);
extern
int
unlink
(
const
char
*
filename
);
#define remove unlink
#endif
/* !defined remove */
#endif
/* !defined remove */
/*
* Private function declarations.
*/
extern
char
*
icalloc
(
int
nelem
,
int
elsize
);
extern
char
*
icatalloc
(
char
*
old
,
const
char
*
new
);
extern
char
*
icpyalloc
(
const
char
*
string
);
extern
char
*
imalloc
(
int
n
);
extern
void
*
irealloc
(
void
*
pointer
,
int
size
);
extern
void
icfree
(
char
*
pointer
);
extern
void
ifree
(
char
*
pointer
);
extern
char
*
scheck
(
const
char
*
string
,
const
char
*
format
);
extern
char
*
icalloc
(
int
nelem
,
int
elsize
);
extern
char
*
icatalloc
(
char
*
old
,
const
char
*
new
);
extern
char
*
icpyalloc
(
const
char
*
string
);
extern
char
*
imalloc
(
int
n
);
extern
void
*
irealloc
(
void
*
pointer
,
int
size
);
extern
void
icfree
(
char
*
pointer
);
extern
void
ifree
(
char
*
pointer
);
extern
char
*
scheck
(
const
char
*
string
,
const
char
*
format
);
/*
...
...
@@ -75,19 +76,19 @@ extern char *scheck (const char *string, const char *format);
#ifndef TRUE
#define TRUE 1
#endif
/* !defined TRUE */
#endif
/* !defined TRUE */
#ifndef FALSE
#define FALSE 0
#endif
/* !defined FALSE */
#endif
/* !defined FALSE */
#ifndef TYPE_BIT
#define TYPE_BIT(type) (sizeof (type) * CHAR_BIT)
#endif
/* !defined TYPE_BIT */
#endif
/* !defined TYPE_BIT */
#ifndef TYPE_SIGNED
#define TYPE_SIGNED(type) (((type) -1) < 0)
#endif
/* !defined TYPE_SIGNED */
#endif
/* !defined TYPE_SIGNED */
#ifndef INT_STRLEN_MAXIMUM
/*
...
...
@@ -97,8 +98,8 @@ extern char *scheck (const char *string, const char *format);
** add one more for a minus sign if the type is signed.
*/
#define INT_STRLEN_MAXIMUM(type) \
((TYPE_BIT(type) - TYPE_SIGNED(type)) * 302 / 1000 + 1 + TYPE_SIGNED(type))
#endif
/* !defined INT_STRLEN_MAXIMUM */
((TYPE_BIT(type) - TYPE_SIGNED(type)) * 302 / 1000 + 1 + TYPE_SIGNED(type))
#endif
/* !defined INT_STRLEN_MAXIMUM */
#define _(msgid) (msgid)
...
...
@@ -106,4 +107,4 @@ extern char *scheck (const char *string, const char *format);
** UNIX was a registered trademark of The Open Group in 2003.
*/
#endif
/* !defined PRIVATE_H */
#endif
/* !defined PRIVATE_H */
src/timezone/scheck.c
View file @
0a19fb42
...
...
@@ -3,15 +3,16 @@
#include "private.h"
char
*
scheck
(
const
char
*
string
,
const
char
*
format
)
char
*
scheck
(
const
char
*
string
,
const
char
*
format
)
{
register
char
*
fbuf
;
register
const
char
*
fp
;
register
char
*
tp
;
register
int
c
;
register
char
*
result
;
char
dummy
;
static
char
nada
;
register
char
*
fbuf
;
register
const
char
*
fp
;
register
char
*
tp
;
register
int
c
;
register
char
*
result
;
char
dummy
;
static
char
nada
;
result
=
&
nada
;
if
(
string
==
NULL
||
format
==
NULL
)
...
...
@@ -21,10 +22,12 @@ char *scheck(const char *string, const char *format)
return
result
;
fp
=
format
;
tp
=
fbuf
;
while
((
*
tp
++
=
c
=
*
fp
++
)
!=
'\0'
)
{
while
((
*
tp
++
=
c
=
*
fp
++
)
!=
'\0'
)
{
if
(
c
!=
'%'
)
continue
;
if
(
*
fp
==
'%'
)
{
if
(
*
fp
==
'%'
)
{
*
tp
++
=
*
fp
++
;
continue
;
}
...
...
@@ -36,8 +39,9 @@ char *scheck(const char *string, const char *format)
if
(
*
fp
==
'l'
||
*
fp
==
'h'
)
*
tp
++
=
*
fp
++
;
else
if
(
*
fp
==
'['
)
do
*
tp
++
=
*
fp
++
;
while
(
*
fp
!=
'\0'
&&
*
fp
!=
']'
);
do
*
tp
++
=
*
fp
++
;
while
(
*
fp
!=
'\0'
&&
*
fp
!=
']'
);
if
((
*
tp
++
=
*
fp
++
)
==
'\0'
)
break
;
}
...
...
src/timezone/strftime.c
View file @
0a19fb42
This diff is collapsed.
Click to expand it.
src/timezone/tzfile.h
View file @
0a19fb42
...
...
@@ -26,17 +26,20 @@
** Each file begins with. . .
*/
#define TZ_MAGIC "TZif"
struct
tzhead
{
char
tzh_magic
[
4
];
/* TZ_MAGIC */
char
tzh_reserved
[
16
];
/* reserved for future use */
char
tzh_ttisgmtcnt
[
4
];
/* coded number of trans. time flags */
char
tzh_ttisstdcnt
[
4
];
/* coded number of trans. time flags */
char
tzh_leapcnt
[
4
];
/* coded number of leap seconds */
char
tzh_timecnt
[
4
];
/* coded number of transition times */
char
tzh_typecnt
[
4
];
/* coded number of local time types */
char
tzh_charcnt
[
4
];
/* coded number of abbr. chars */
#define TZ_MAGIC "TZif"
struct
tzhead
{
char
tzh_magic
[
4
];
/* TZ_MAGIC */
char
tzh_reserved
[
16
];
/* reserved for future use */
char
tzh_ttisgmtcnt
[
4
];
/* coded number of trans. time
* flags */
char
tzh_ttisstdcnt
[
4
];
/* coded number of trans. time
* flags */
char
tzh_leapcnt
[
4
];
/* coded number of leap seconds */
char
tzh_timecnt
[
4
];
/* coded number of transition times */
char
tzh_typecnt
[
4
];
/* coded number of local time types */
char
tzh_charcnt
[
4
];
/* coded number of abbr. chars */
};
/*
...
...
@@ -46,8 +49,8 @@ struct tzhead {
** tzh_timecnt (unsigned char)s types of local time starting at above
** tzh_typecnt repetitions of
** one (char [4]) coded UTC offset in seconds
** one (unsigned char)
used to set tm_isdst
** one (unsigned char)
that's an abbreviation list index
** one (unsigned char)
used to set tm_isdst
** one (unsigned char)
that's an abbreviation list index
** tzh_charcnt (char)s '\0'-terminated zone abbreviations
** tzh_leapcnt repetitions of
** one (char [4]) coded leap second transition times
...
...
@@ -77,33 +80,36 @@ struct tzhead {
*/
#define TZ_MAX_TIMES 370
#define TZ_MAX_TYPES 256
/* Limited by what (unsigned char)'s can hold */
#define TZ_MAX_TYPES 256
/* Limited by what (unsigned char)'s can
* hold */
#define TZ_MAX_CHARS 50
/* Maximum number of abbreviation characters */
/* (limited by what unsigned chars can hold) */
#define TZ_MAX_CHARS 50
/* Maximum number of abbreviation
* characters */
/* (limited by what unsigned chars can hold) */
#define TZ_MAX_LEAPS 50
/* Maximum number of leap second corrections */
#define TZ_MAX_LEAPS 50
/* Maximum number of leap second
* corrections */
#define SECSPERMIN 60
#define MINSPERHOUR
60
#define HOURSPERDAY
24
#define DAYSPERWEEK
7
#define MINSPERHOUR
60
#define HOURSPERDAY
24
#define DAYSPERWEEK
7
#define DAYSPERNYEAR 365
#define DAYSPERLYEAR 366
#define SECSPERHOUR
(SECSPERMIN * MINSPERHOUR)
#define SECSPERHOUR
(SECSPERMIN * MINSPERHOUR)
#define SECSPERDAY ((long) SECSPERHOUR * HOURSPERDAY)
#define MONSPERYEAR
12
#define MONSPERYEAR
12
#define TM_SUNDAY 0
#define TM_MONDAY 1
#define TM_TUESDAY 2
#define TM_WEDNESDAY 3
#define TM_THURSDAY
4
#define TM_THURSDAY
4
#define TM_FRIDAY 5
#define TM_SATURDAY
6
#define TM_SATURDAY
6
#define TM_JANUARY 0
#define TM_FEBRUARY
1
#define TM_FEBRUARY
1
#define TM_MARCH 2
#define TM_APRIL 3
#define TM_MAY 4
...
...
@@ -112,8 +118,8 @@ struct tzhead {
#define TM_AUGUST 7
#define TM_SEPTEMBER 8
#define TM_OCTOBER 9
#define TM_NOVEMBER
10
#define TM_DECEMBER
11
#define TM_NOVEMBER
10
#define TM_DECEMBER
11
#define TM_YEAR_BASE 1900
...
...
@@ -127,4 +133,4 @@ struct tzhead {
#define isleap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0))
#endif
/* !defined TZFILE_H */
#endif
/* !defined TZFILE_H */
src/timezone/zic.c
View file @
0a19fb42
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment