1 | // |
2 | // Timezone.h |
3 | // |
4 | // Library: Foundation |
5 | // Package: DateTime |
6 | // Module: Timezone |
7 | // |
8 | // Definition of the Timezone class. |
9 | // |
10 | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. |
11 | // and Contributors. |
12 | // |
13 | // SPDX-License-Identifier: BSL-1.0 |
14 | // |
15 | |
16 | |
17 | #ifndef Foundation_Timezone_INCLUDED |
18 | #define Foundation_Timezone_INCLUDED |
19 | |
20 | |
21 | #include "Poco/Foundation.h" |
22 | #include "Poco/Timestamp.h" |
23 | |
24 | |
25 | namespace Poco { |
26 | |
27 | |
28 | class Foundation_API Timezone |
29 | /// This class provides information about the current timezone. |
30 | { |
31 | public: |
32 | static int utcOffset(); |
33 | /// Returns the offset of local time to UTC, in seconds. |
34 | /// local time = UTC + utcOffset() + dst(). |
35 | |
36 | static int dst(); |
37 | /// Returns the daylight saving time offset in seconds if |
38 | /// daylight saving time is in use. |
39 | /// local time = UTC + utcOffset() + dst(). |
40 | |
41 | static bool isDst(const Timestamp& timestamp); |
42 | /// Returns true if daylight saving time is in effect |
43 | /// for the given time. Depending on the operating system |
44 | /// platform this might only work reliably for certain |
45 | /// date ranges, as the C library's localtime() function |
46 | /// is used. |
47 | |
48 | static int tzd(); |
49 | /// Returns the time zone differential for the current timezone. |
50 | /// The timezone differential is computed as utcOffset() + dst() |
51 | /// and is expressed in seconds. |
52 | |
53 | static std::string name(); |
54 | /// Returns the timezone name currently in effect. |
55 | |
56 | static std::string standardName(); |
57 | /// Returns the timezone name if not daylight saving time is in effect. |
58 | |
59 | static std::string dstName(); |
60 | /// Returns the timezone name if daylight saving time is in effect. |
61 | }; |
62 | |
63 | |
64 | } // namespace Poco |
65 | |
66 | |
67 | #endif // Foundation_Timezone_INCLUDED |
68 | |