]> granicus.if.org Git - postgresql/blob - src/timezone/pgtz.c
Add Olson's public domain timezone library to src/timezone.
[postgresql] / src / timezone / pgtz.c
1 /*-------------------------------------------------------------------------
2  *
3  * pgtz.c
4  *    Timezone Library Integration Functions
5  *
6  * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
7  *
8  * IDENTIFICATION
9  *        $PostgreSQL: pgsql/src/timezone/pgtz.c,v 1.1 2004/04/30 04:09:23 momjian Exp $
10  *
11  *-------------------------------------------------------------------------
12  */
13
14 #include "pgtz.h"
15 #include "tzfile.h"
16
17
18 #ifdef WIN32
19 static char tzdir[MAXPGPATH];
20 static int done_tzdir = 0;
21 char *pgwin32_TZDIR(void) {
22         char *p;
23         if (done_tzdir)
24                 return tzdir;
25
26         if (GetModuleFileName(NULL,tzdir,MAXPGPATH) == 0)
27                 return NULL;
28         
29         canonicalize_path(tzdir);
30         if ((p = last_path_separator(tzdir)) == NULL)
31                 return NULL;
32         else
33                 *p = '\0';
34         
35         strcat(tzdir,"/../share/timezone");
36
37         done_tzdir=1;
38         return tzdir;
39 }
40 #else
41 #error pgwin32_TZDIR not implemented on non win32 yet!
42 #endif