Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6a2b75c

Browse files
committed
Add Olson's public domain timezone library to src/timezone.
1 parentd51d870 commit6a2b75c

31 files changed

+16039
-0
lines changed

‎src/timezone/Makefile

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#-------------------------------------------------------------------------
2+
#
3+
# Makefile--
4+
# Makefile for the timezone library
5+
6+
# IDENTIFICATION
7+
# $PostgreSQL: pgsql/src/timezone/Makefile,v 1.1 2004/04/30 04:09:23 momjian Exp $
8+
#
9+
#-------------------------------------------------------------------------
10+
11+
subdir = src/port/tz
12+
top_builddir = ../../..
13+
include$(top_builddir)/src/Makefile.global
14+
15+
OBJS= asctime.o difftime.o localtime.o pgtz.o
16+
ZICOBJS= zic.o ialloc.o scheck.o localtime.o asctime.o pgtz.o ../path.o
17+
18+
TZDATA := africa antarctica asia australasia europe northamerica southamerica pacificnew etcetera factory backward systemv solar87 solar88 solar89
19+
TZDATAFILES :=$(TZDATA:%=data/%)
20+
21+
all: SUBSYS.o zic
22+
23+
SUBSYS.o:$(OBJS)
24+
$(LD)$(LDREL)$(LDOUT) SUBSYS.o$(OBJS)
25+
26+
27+
zic:$(ZICOBJS)
28+
29+
install: zic
30+
zic -d$(datadir)/timezone$(TZDATAFILES)
31+
32+
cleandistcleanmaintainer-clean:
33+
rm -f SUBSYS.o$(OBJS)$(ZICOBJS)

‎src/timezone/README

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
This is a PostgreSQL adapted version of the timezone library
2+
from:
3+
ftp://elsie.nci.nih.gov/pub/tz*.tar.gz
4+
5+
6+
The interface is used when USE_PGTZ is defined at the top level. This
7+
will cause the following functions to be redefined:
8+
localtimepg_localtime
9+
gmtimepg_gmtime
10+
asctimepg_asctime
11+
ctimepg_ctime
12+
difftimepg_difftime
13+
mktimepg_mktime
14+
tzsetpg_tzset
15+
16+
and the TIMEZONE_GLOBAL define in c.h is redefined to pg_timezone.
17+

‎src/timezone/asctime.c

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/*
2+
** This file is in the public domain, so clarified as of
3+
** 1996-06-05 by Arthur David Olson (arthur_david_olson@nih.gov).
4+
*/
5+
6+
#ifndeflint
7+
#ifndefNOID
8+
staticcharelsieid[]="@(#)asctime.c7.9";
9+
#endif/* !defined NOID */
10+
#endif/* !defined lint */
11+
12+
/*LINTLIBRARY*/
13+
14+
#include"private.h"
15+
#include"tzfile.h"
16+
17+
/*
18+
** A la ISO/IEC 9945-1, ANSI/IEEE Std 1003.1, Second Edition, 1996-07-12.
19+
*/
20+
21+
char*
22+
asctime_r(timeptr,buf)
23+
registerconststructtm*timeptr;
24+
char*buf;
25+
{
26+
staticconstcharwday_name[][3]= {
27+
"Sun","Mon","Tue","Wed","Thu","Fri","Sat"
28+
};
29+
staticconstcharmon_name[][3]= {
30+
"Jan","Feb","Mar","Apr","May","Jun",
31+
"Jul","Aug","Sep","Oct","Nov","Dec"
32+
};
33+
registerconstchar*wn;
34+
registerconstchar*mn;
35+
36+
if (timeptr->tm_wday<0||timeptr->tm_wday >=DAYSPERWEEK)
37+
wn="???";
38+
elsewn=wday_name[timeptr->tm_wday];
39+
if (timeptr->tm_mon<0||timeptr->tm_mon >=MONSPERYEAR)
40+
mn="???";
41+
elsemn=mon_name[timeptr->tm_mon];
42+
/*
43+
** The X3J11-suggested format is
44+
**"%.3s %.3s%3d %02.2d:%02.2d:%02.2d %d\n"
45+
** Since the .2 in 02.2d is ignored, we drop it.
46+
*/
47+
(void)sprintf(buf,"%.3s %.3s%3d %02d:%02d:%02d %d\n",
48+
wn,mn,
49+
timeptr->tm_mday,timeptr->tm_hour,
50+
timeptr->tm_min,timeptr->tm_sec,
51+
TM_YEAR_BASE+timeptr->tm_year);
52+
returnbuf;
53+
}
54+
55+
/*
56+
** A la X3J11, with core dump avoidance.
57+
*/
58+
59+
char*
60+
asctime(timeptr)
61+
registerconststructtm*timeptr;
62+
{
63+
/*
64+
** Big enough for something such as
65+
** ??? ???-2147483648 -2147483648:-2147483648:-2147483648 -2147483648\n
66+
** (two three-character abbreviations, five strings denoting integers,
67+
** three explicit spaces, two explicit colons, a newline,
68+
** and a trailing ASCII nul).
69+
*/
70+
staticcharresult[3*2+5*INT_STRLEN_MAXIMUM(int)+
71+
3+2+1+1];
72+
73+
returnasctime_r(timeptr,result);
74+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp