Consistently use "superuser" instead of "super user"
[pgsql.git] / src / include / pgtime.h
blob92350527f65ec118a4cba1be5e305f0984ef27f1
1 /*-------------------------------------------------------------------------
3 * pgtime.h
4 * PostgreSQL internal timezone library
6 * Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
8 * IDENTIFICATION
9 * src/include/pgtime.h
11 *-------------------------------------------------------------------------
13 #ifndef _PGTIME_H
14 #define _PGTIME_H
18 * The API of this library is generally similar to the corresponding
19 * C library functions, except that we use pg_time_t which (we hope) is
20 * 64 bits wide, and which is most definitely signed not unsigned.
23 typedef int64 pg_time_t;
26 * CAUTION: the IANA timezone library (src/timezone/) follows the POSIX
27 * convention that tm_mon counts from 0 and tm_year is relative to 1900.
28 * However, Postgres' datetime functions generally treat tm_mon as counting
29 * from 1 and tm_year as relative to 1 BC. Be sure to make the appropriate
30 * adjustments when moving from one code domain to the other.
32 struct pg_tm
34 int tm_sec;
35 int tm_min;
36 int tm_hour;
37 int tm_mday;
38 int tm_mon; /* see above */
39 int tm_year; /* see above */
40 int tm_wday;
41 int tm_yday;
42 int tm_isdst;
43 long int tm_gmtoff;
44 const char *tm_zone;
47 typedef struct pg_tz pg_tz;
48 typedef struct pg_tzenum pg_tzenum;
50 /* Maximum length of a timezone name (not including trailing null) */
51 #define TZ_STRLEN_MAX 255
53 /* these functions are in localtime.c */
55 extern struct pg_tm *pg_localtime(const pg_time_t *timep, const pg_tz *tz);
56 extern struct pg_tm *pg_gmtime(const pg_time_t *timep);
57 extern int pg_next_dst_boundary(const pg_time_t *timep,
58 long int *before_gmtoff,
59 int *before_isdst,
60 pg_time_t *boundary,
61 long int *after_gmtoff,
62 int *after_isdst,
63 const pg_tz *tz);
64 extern bool pg_interpret_timezone_abbrev(const char *abbrev,
65 const pg_time_t *timep,
66 long int *gmtoff,
67 int *isdst,
68 const pg_tz *tz);
69 extern bool pg_get_timezone_offset(const pg_tz *tz, long int *gmtoff);
70 extern const char *pg_get_timezone_name(pg_tz *tz);
71 extern bool pg_tz_acceptable(pg_tz *tz);
73 /* these functions are in strftime.c */
75 extern size_t pg_strftime(char *s, size_t max, const char *format,
76 const struct pg_tm *tm);
78 /* these functions and variables are in pgtz.c */
80 extern PGDLLIMPORT pg_tz *session_timezone;
81 extern pg_tz *log_timezone;
83 extern void pg_timezone_initialize(void);
84 extern pg_tz *pg_tzset(const char *tzname);
85 extern pg_tz *pg_tzset_offset(long gmtoffset);
87 extern pg_tzenum *pg_tzenumerate_start(void);
88 extern pg_tz *pg_tzenumerate_next(pg_tzenum *dir);
89 extern void pg_tzenumerate_end(pg_tzenum *dir);
91 #endif /* _PGTIME_H */