]> granicus.if.org Git - postgresql/blob - src/include/pgtime.h
Create the planner mechanism for optimizing simple MIN and MAX queries
[postgresql] / src / include / pgtime.h
1 /*-------------------------------------------------------------------------
2  *
3  * pgtime.h
4  *        PostgreSQL internal timezone library
5  *
6  * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
7  *
8  * IDENTIFICATION
9  *        $PostgreSQL: pgsql/src/include/pgtime.h,v 1.6 2004/12/31 22:03:19 pgsql Exp $
10  *
11  *-------------------------------------------------------------------------
12  */
13 #ifndef _PGTIME_H
14 #define _PGTIME_H
15
16
17 /*
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.
21  */
22
23 typedef int64 pg_time_t;
24
25 struct pg_tm
26 {
27         int                     tm_sec;
28         int                     tm_min;
29         int                     tm_hour;
30         int                     tm_mday;
31         int                     tm_mon;                 /* origin 0, not 1 */
32         int                     tm_year;                /* relative to 1900 */
33         int                     tm_wday;
34         int                     tm_yday;
35         int                     tm_isdst;
36         long int        tm_gmtoff;
37         const char *tm_zone;
38 };
39
40 extern struct pg_tm *pg_localtime(const pg_time_t *timep);
41 extern struct pg_tm *pg_gmtime(const pg_time_t *timep);
42 extern int      pg_next_dst_boundary(const pg_time_t *timep,
43                                                                  long int *before_gmtoff,
44                                                                  int *before_isdst,
45                                                                  pg_time_t *boundary,
46                                                                  long int *after_gmtoff,
47                                                                  int *after_isdst);
48 extern size_t pg_strftime(char *s, size_t max, const char *format,
49                         const struct pg_tm * tm);
50
51 extern void pg_timezone_initialize(void);
52 extern bool pg_tzset(const char *tzname);
53 extern bool tz_acceptable(void);
54 extern const char *select_default_timezone(void);
55 extern const char *pg_get_current_timezone(void);
56
57 #endif   /* _PGTIME_H */