fix config file path
[AROS.git] / compiler / clib / __arosc_gmtoffset.c
blobdd7a2304c7ca4e2cbb26721bff541cac347ac6a4
1 /*
2 Copyright © 1995-2012, The AROS Development Team. All rights reserved.
3 $Id$
5 Internal arossstdc function to get current GMT offset
6 */
7 #include <proto/exec.h>
8 #include <proto/locale.h>
9 #include <exec/execbase.h>
11 /*****************************************************************************
13 NAME */
14 #include <time.h>
16 int __arosc_gmtoffset (
18 /* SYNOPSIS */
19 void)
21 /* FUNCTION
23 INPUTS
25 RESULT
26 The offset to GMT in minutes
28 NOTES
29 Will return 0 when locale.library is not loaded into memory yet.
31 EXAMPLE
33 BUGS
35 SEE ALSO
37 INTERNALS
38 Will always query the current locale through locale.library to
39 get the GMT offset.
41 ******************************************************************************/
43 static struct LocaleBase *LocaleBase = NULL;
44 struct Locale *loc;
45 int gmtoffset = 0;
47 if (!LocaleBase)
49 struct Node *found;
51 /* Only open locale.library if it does not have to be loaded from disk */
52 Forbid();
53 found = FindName(&SysBase->LibList, "locale.library");
54 Permit();
56 if (found)
57 LocaleBase = (struct LocaleBase *)OpenLibrary("locale.library", 0);
60 if (LocaleBase && (loc = OpenLocale(NULL)))
62 gmtoffset = (int)loc->loc_GMTOffset;
63 CloseLocale(loc);
66 return gmtoffset;