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
e9a028f8
Commit
e9a028f8
authored
Apr 30, 2004
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert DOS newlines to Unix newlines.
parent
7146eb0b
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
4751 additions
and
4753 deletions
+4751
-4753
src/timezone/asctime.c
src/timezone/asctime.c
+75
-75
src/timezone/difftime.c
src/timezone/difftime.c
+84
-84
src/timezone/ialloc.c
src/timezone/ialloc.c
+81
-81
src/timezone/localtime.c
src/timezone/localtime.c
+1712
-1712
src/timezone/pgtz.h
src/timezone/pgtz.h
+0
-2
src/timezone/private.h
src/timezone/private.h
+294
-294
src/timezone/scheck.c
src/timezone/scheck.c
+59
-59
src/timezone/tzfile.h
src/timezone/tzfile.h
+188
-188
src/timezone/zic.c
src/timezone/zic.c
+2258
-2258
No files found.
src/timezone/asctime.c
View file @
e9a028f8
#include "pgtz.h"
/*
** This file is in the public domain, so clarified as of
** 1996-06-05 by Arthur David Olson (arthur_david_olson@nih.gov).
*/
#ifndef lint
#ifndef NOID
static
char
elsieid
[]
=
"@(#)asctime.c 7.9"
;
#endif
/* !defined NOID */
#endif
/* !defined lint */
/*LINTLIBRARY*/
#include "private.h"
#include "tzfile.h"
/*
** A la ISO/IEC 9945-1, ANSI/IEEE Std 1003.1, Second Edition, 1996-07-12.
*/
char
*
asctime_r
(
timeptr
,
buf
)
register
const
struct
tm
*
timeptr
;
char
*
buf
;
{
static
const
char
wday_name
[][
3
]
=
{
"Sun"
,
"Mon"
,
"Tue"
,
"Wed"
,
"Thu"
,
"Fri"
,
"Sat"
};
static
const
char
mon_name
[][
3
]
=
{
"Jan"
,
"Feb"
,
"Mar"
,
"Apr"
,
"May"
,
"Jun"
,
"Jul"
,
"Aug"
,
"Sep"
,
"Oct"
,
"Nov"
,
"Dec"
};
register
const
char
*
wn
;
register
const
char
*
mn
;
if
(
timeptr
->
tm_wday
<
0
||
timeptr
->
tm_wday
>=
DAYSPERWEEK
)
wn
=
"???"
;
else
wn
=
wday_name
[
timeptr
->
tm_wday
];
if
(
timeptr
->
tm_mon
<
0
||
timeptr
->
tm_mon
>=
MONSPERYEAR
)
mn
=
"???"
;
else
mn
=
mon_name
[
timeptr
->
tm_mon
];
/*
** The X3J11-suggested format is
** "%.3s %.3s%3d %02.2d:%02.2d:%02.2d %d\n"
** Since the .2 in 02.2d is ignored, we drop it.
*/
(
void
)
sprintf
(
buf
,
"%.3s %.3s%3d %02d:%02d:%02d %d
\n
"
,
wn
,
mn
,
timeptr
->
tm_mday
,
timeptr
->
tm_hour
,
timeptr
->
tm_min
,
timeptr
->
tm_sec
,
TM_YEAR_BASE
+
timeptr
->
tm_year
);
return
buf
;
}
/*
** A la X3J11, with core dump avoidance.
*/
char
*
asctime
(
timeptr
)
register
const
struct
tm
*
timeptr
;
{
/*
** Big enough for something such as
** ??? ???-2147483648 -2147483648:-2147483648:-2147483648 -2147483648\n
** (two three-character abbreviations, five strings denoting integers,
** three explicit spaces, two explicit colons, a newline,
** and a trailing ASCII nul).
*/
static
char
result
[
3
*
2
+
5
*
INT_STRLEN_MAXIMUM
(
int
)
+
3
+
2
+
1
+
1
];
return
asctime_r
(
timeptr
,
result
);
}
#include "pgtz.h"
/*
** This file is in the public domain, so clarified as of
** 1996-06-05 by Arthur David Olson (arthur_david_olson@nih.gov).
*/
#ifndef lint
#ifndef NOID
static
char
elsieid
[]
=
"@(#)asctime.c 7.9"
;
#endif
/* !defined NOID */
#endif
/* !defined lint */
/*LINTLIBRARY*/
#include "private.h"
#include "tzfile.h"
/*
** A la ISO/IEC 9945-1, ANSI/IEEE Std 1003.1, Second Edition, 1996-07-12.
*/
char
*
asctime_r
(
timeptr
,
buf
)
register
const
struct
tm
*
timeptr
;
char
*
buf
;
{
static
const
char
wday_name
[][
3
]
=
{
"Sun"
,
"Mon"
,
"Tue"
,
"Wed"
,
"Thu"
,
"Fri"
,
"Sat"
};
static
const
char
mon_name
[][
3
]
=
{
"Jan"
,
"Feb"
,
"Mar"
,
"Apr"
,
"May"
,
"Jun"
,
"Jul"
,
"Aug"
,
"Sep"
,
"Oct"
,
"Nov"
,
"Dec"
};
register
const
char
*
wn
;
register
const
char
*
mn
;
if
(
timeptr
->
tm_wday
<
0
||
timeptr
->
tm_wday
>=
DAYSPERWEEK
)
wn
=
"???"
;
else
wn
=
wday_name
[
timeptr
->
tm_wday
];
if
(
timeptr
->
tm_mon
<
0
||
timeptr
->
tm_mon
>=
MONSPERYEAR
)
mn
=
"???"
;
else
mn
=
mon_name
[
timeptr
->
tm_mon
];
/*
** The X3J11-suggested format is
** "%.3s %.3s%3d %02.2d:%02.2d:%02.2d %d\n"
** Since the .2 in 02.2d is ignored, we drop it.
*/
(
void
)
sprintf
(
buf
,
"%.3s %.3s%3d %02d:%02d:%02d %d
\n
"
,
wn
,
mn
,
timeptr
->
tm_mday
,
timeptr
->
tm_hour
,
timeptr
->
tm_min
,
timeptr
->
tm_sec
,
TM_YEAR_BASE
+
timeptr
->
tm_year
);
return
buf
;
}
/*
** A la X3J11, with core dump avoidance.
*/
char
*
asctime
(
timeptr
)
register
const
struct
tm
*
timeptr
;
{
/*
** Big enough for something such as
** ??? ???-2147483648 -2147483648:-2147483648:-2147483648 -2147483648\n
** (two three-character abbreviations, five strings denoting integers,
** three explicit spaces, two explicit colons, a newline,
** and a trailing ASCII nul).
*/
static
char
result
[
3
*
2
+
5
*
INT_STRLEN_MAXIMUM
(
int
)
+
3
+
2
+
1
+
1
];
return
asctime_r
(
timeptr
,
result
);
}
src/timezone/difftime.c
View file @
e9a028f8
#include "pgtz.h"
/*
** This file is in the public domain, so clarified as of
** June 5, 1996 by Arthur David Olson (arthur_david_olson@nih.gov).
*/
#ifndef lint
#ifndef NOID
static
char
elsieid
[]
=
"@(#)difftime.c 7.9"
;
#endif
/* !defined NOID */
#endif
/* !defined lint */
/*LINTLIBRARY*/
#include "private.h"
/*
** Algorithm courtesy Paul Eggert (eggert@twinsun.com).
*/
#ifdef HAVE_LONG_DOUBLE
#define long_double long double
#endif
/* defined HAVE_LONG_DOUBLE */
#ifndef HAVE_LONG_DOUBLE
#define long_double double
#endif
/* !defined HAVE_LONG_DOUBLE */
double
difftime
(
time1
,
time0
)
const
time_t
time1
;
const
time_t
time0
;
{
time_t
delta
;
time_t
hibit
;
{
time_t
tt
;
double
d
;
long_double
ld
;
if
(
sizeof
tt
<
sizeof
d
)
return
(
double
)
time1
-
(
double
)
time0
;
if
(
sizeof
tt
<
sizeof
ld
)
return
(
long_double
)
time1
-
(
long_double
)
time0
;
}
if
(
time1
<
time0
)
return
-
difftime
(
time0
,
time1
);
/*
** As much as possible, avoid loss of precision
** by computing the difference before converting to double.
*/
delta
=
time1
-
time0
;
if
(
delta
>=
0
)
return
delta
;
/*
** Repair delta overflow.
*/
hibit
=
(
~
(
time_t
)
0
)
<<
(
TYPE_BIT
(
time_t
)
-
1
);
/*
** The following expression rounds twice, which means
** the result may not be the closest to the true answer.
** For example, suppose time_t is 64-bit signed int,
** long_double is IEEE 754 double with default rounding,
** time1 = 9223372036854775807 and time0 = -1536.
** Then the true difference is 9223372036854777343,
** which rounds to 9223372036854777856
** with a total error of 513.
** But delta overflows to -9223372036854774273,
** which rounds to -9223372036854774784, and correcting
** this by subtracting 2 * (long_double) hibit
** (i.e. by adding 2**64 = 18446744073709551616)
** yields 9223372036854776832, which
** rounds to 9223372036854775808
** with a total error of 1535 instead.
** This problem occurs only with very large differences.
** It's too painful to fix this portably.
** We are not alone in this problem;
** some C compilers round twice when converting
** large unsigned types to small floating types,
** so if time_t is unsigned the "return delta" above
** has the same double-rounding problem with those compilers.
*/
return
delta
-
2
*
(
long_double
)
hibit
;
}
#include "pgtz.h"
/*
** This file is in the public domain, so clarified as of
** June 5, 1996 by Arthur David Olson (arthur_david_olson@nih.gov).
*/
#ifndef lint
#ifndef NOID
static
char
elsieid
[]
=
"@(#)difftime.c 7.9"
;
#endif
/* !defined NOID */
#endif
/* !defined lint */
/*LINTLIBRARY*/
#include "private.h"
/*
** Algorithm courtesy Paul Eggert (eggert@twinsun.com).
*/
#ifdef HAVE_LONG_DOUBLE
#define long_double long double
#endif
/* defined HAVE_LONG_DOUBLE */
#ifndef HAVE_LONG_DOUBLE
#define long_double double
#endif
/* !defined HAVE_LONG_DOUBLE */
double
difftime
(
time1
,
time0
)
const
time_t
time1
;
const
time_t
time0
;
{
time_t
delta
;
time_t
hibit
;
{
time_t
tt
;
double
d
;
long_double
ld
;
if
(
sizeof
tt
<
sizeof
d
)
return
(
double
)
time1
-
(
double
)
time0
;
if
(
sizeof
tt
<
sizeof
ld
)
return
(
long_double
)
time1
-
(
long_double
)
time0
;
}
if
(
time1
<
time0
)
return
-
difftime
(
time0
,
time1
);
/*
** As much as possible, avoid loss of precision
** by computing the difference before converting to double.
*/
delta
=
time1
-
time0
;
if
(
delta
>=
0
)
return
delta
;
/*
** Repair delta overflow.
*/
hibit
=
(
~
(
time_t
)
0
)
<<
(
TYPE_BIT
(
time_t
)
-
1
);
/*
** The following expression rounds twice, which means
** the result may not be the closest to the true answer.
** For example, suppose time_t is 64-bit signed int,
** long_double is IEEE 754 double with default rounding,
** time1 = 9223372036854775807 and time0 = -1536.
** Then the true difference is 9223372036854777343,
** which rounds to 9223372036854777856
** with a total error of 513.
** But delta overflows to -9223372036854774273,
** which rounds to -9223372036854774784, and correcting
** this by subtracting 2 * (long_double) hibit
** (i.e. by adding 2**64 = 18446744073709551616)
** yields 9223372036854776832, which
** rounds to 9223372036854775808
** with a total error of 1535 instead.
** This problem occurs only with very large differences.
** It's too painful to fix this portably.
** We are not alone in this problem;
** some C compilers round twice when converting
** large unsigned types to small floating types,
** so if time_t is unsigned the "return delta" above
** has the same double-rounding problem with those compilers.
*/
return
delta
-
2
*
(
long_double
)
hibit
;
}
src/timezone/ialloc.c
View file @
e9a028f8
#ifndef lint
#ifndef NOID
static
char
elsieid
[]
=
"@(#)ialloc.c 8.29"
;
#endif
/* !defined NOID */
#endif
/* !defined lint */
/*LINTLIBRARY*/
#include "private.h"
#define nonzero(n) (((n) == 0) ? 1 : (n))
char
*
imalloc
(
n
)
const
int
n
;
{
return
malloc
((
size_t
)
nonzero
(
n
));
}
char
*
icalloc
(
nelem
,
elsize
)
int
nelem
;
int
elsize
;
{
if
(
nelem
==
0
||
elsize
==
0
)
nelem
=
elsize
=
1
;
return
calloc
((
size_t
)
nelem
,
(
size_t
)
elsize
);
}
void
*
irealloc
(
pointer
,
size
)
void
*
const
pointer
;
const
int
size
;
{
if
(
pointer
==
NULL
)
return
imalloc
(
size
);
return
realloc
((
void
*
)
pointer
,
(
size_t
)
nonzero
(
size
));
}
char
*
icatalloc
(
old
,
new
)
char
*
const
old
;
const
char
*
const
new
;
{
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
);
if
((
result
=
irealloc
(
old
,
oldsize
+
newsize
+
1
))
!=
NULL
)
if
(
new
!=
NULL
)
(
void
)
strcpy
(
result
+
oldsize
,
new
);
return
result
;
}
char
*
icpyalloc
(
string
)
const
char
*
const
string
;
{
return
icatalloc
((
char
*
)
NULL
,
string
);
}
void
ifree
(
p
)
char
*
const
p
;
{
if
(
p
!=
NULL
)
(
void
)
free
(
p
);
}
void
icfree
(
p
)
char
*
const
p
;
{
if
(
p
!=
NULL
)
(
void
)
free
(
p
);
}
#ifndef lint
#ifndef NOID
static
char
elsieid
[]
=
"@(#)ialloc.c 8.29"
;
#endif
/* !defined NOID */
#endif
/* !defined lint */
/*LINTLIBRARY*/
#include "private.h"
#define nonzero(n) (((n) == 0) ? 1 : (n))
char
*
imalloc
(
n
)
const
int
n
;
{
return
malloc
((
size_t
)
nonzero
(
n
));
}
char
*
icalloc
(
nelem
,
elsize
)
int
nelem
;
int
elsize
;
{
if
(
nelem
==
0
||
elsize
==
0
)
nelem
=
elsize
=
1
;
return
calloc
((
size_t
)
nelem
,
(
size_t
)
elsize
);
}
void
*
irealloc
(
pointer
,
size
)
void
*
const
pointer
;
const
int
size
;
{
if
(
pointer
==
NULL
)
return
imalloc
(
size
);
return
realloc
((
void
*
)
pointer
,
(
size_t
)
nonzero
(
size
));
}
char
*
icatalloc
(
old
,
new
)
char
*
const
old
;
const
char
*
const
new
;
{
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
);
if
((
result
=
irealloc
(
old
,
oldsize
+
newsize
+
1
))
!=
NULL
)
if
(
new
!=
NULL
)
(
void
)
strcpy
(
result
+
oldsize
,
new
);
return
result
;
}
char
*
icpyalloc
(
string
)
const
char
*
const
string
;
{
return
icatalloc
((
char
*
)
NULL
,
string
);
}
void
ifree
(
p
)
char
*
const
p
;
{
if
(
p
!=
NULL
)
(
void
)
free
(
p
);
}
void
icfree
(
p
)
char
*
const
p
;
{
if
(
p
!=
NULL
)
(
void
)
free
(
p
);
}
src/timezone/localtime.c
View file @
e9a028f8
This diff is collapsed.
Click to expand it.
src/timezone/pgtz.h
View file @
e9a028f8
#include "postgres.h"
#define NOID
#define HAVE_SYMLINK 0
#define HAVE_SYS_WAIT_H 0
#define TZDIR pgwin32_TZDIR()
char
*
pgwin32_TZDIR
(
void
);
src/timezone/private.h
View file @
e9a028f8
This diff is collapsed.
Click to expand it.
src/timezone/scheck.c
View file @
e9a028f8
#ifndef lint
#ifndef NOID
static
char
elsieid
[]
=
"@(#)scheck.c 8.15"
;
#endif
/* !defined lint */
#endif
/* !defined NOID */
/*LINTLIBRARY*/
#include "private.h"
char
*
scheck
(
string
,
format
)
const
char
*
const
string
;
const
char
*
const
format
;
{
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
)
return
result
;
fbuf
=
imalloc
((
int
)
(
2
*
strlen
(
format
)
+
4
));
if
(
fbuf
==
NULL
)
return
result
;
fp
=
format
;
tp
=
fbuf
;
while
((
*
tp
++
=
c
=
*
fp
++
)
!=
'\0'
)
{
if
(
c
!=
'%'
)
continue
;
if
(
*
fp
==
'%'
)
{
*
tp
++
=
*
fp
++
;
continue
;
}
*
tp
++
=
'*'
;
if
(
*
fp
==
'*'
)
++
fp
;
while
(
is_digit
(
*
fp
))
*
tp
++
=
*
fp
++
;
if
(
*
fp
==
'l'
||
*
fp
==
'h'
)
*
tp
++
=
*
fp
++
;
else
if
(
*
fp
==
'['
)
do
*
tp
++
=
*
fp
++
;
while
(
*
fp
!=
'\0'
&&
*
fp
!=
']'
);
if
((
*
tp
++
=
*
fp
++
)
==
'\0'
)
break
;
}
*
(
tp
-
1
)
=
'%'
;
*
tp
++
=
'c'
;
*
tp
=
'\0'
;
if
(
sscanf
(
string
,
fbuf
,
&
dummy
)
!=
1
)
result
=
(
char
*
)
format
;
ifree
(
fbuf
);
return
result
;
}
#ifndef lint
#ifndef NOID
static
char
elsieid
[]
=
"@(#)scheck.c 8.15"
;
#endif
/* !defined lint */
#endif
/* !defined NOID */
/*LINTLIBRARY*/
#include "private.h"
char
*
scheck
(
string
,
format
)
const
char
*
const
string
;
const
char
*
const
format
;
{
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
)
return
result
;
fbuf
=
imalloc
((
int
)
(
2
*
strlen
(
format
)
+
4
));
if
(
fbuf
==
NULL
)
return
result
;
fp
=
format
;
tp
=
fbuf
;
while
((
*
tp
++
=
c
=
*
fp
++
)
!=
'\0'
)
{
if
(
c
!=
'%'
)
continue
;
if
(
*
fp
==
'%'
)
{
*
tp
++
=
*
fp
++
;
continue
;
}
*
tp
++
=
'*'
;
if
(
*
fp
==
'*'
)
++
fp
;
while
(
is_digit
(
*
fp
))
*
tp
++
=
*
fp
++
;
if
(
*
fp
==
'l'
||
*
fp
==
'h'
)
*
tp
++
=
*
fp
++
;
else
if
(
*
fp
==
'['
)
do
*
tp
++
=
*
fp
++
;
while
(
*
fp
!=
'\0'
&&
*
fp
!=
']'
);
if
((
*
tp
++
=
*
fp
++
)
==
'\0'
)
break
;
}
*
(
tp
-
1
)
=
'%'
;
*
tp
++
=
'c'
;
*
tp
=
'\0'
;
if
(
sscanf
(
string
,
fbuf
,
&
dummy
)
!=
1
)
result
=
(
char
*
)
format
;
ifree
(
fbuf
);
return
result
;
}
src/timezone/tzfile.h
View file @
e9a028f8
This diff is collapsed.
Click to expand it.
src/timezone/zic.c
View file @
e9a028f8
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