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