Diffstat (limited to 'libopie2/opiepim/core/otimezone.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | libopie2/opiepim/core/otimezone.cpp | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/libopie2/opiepim/core/otimezone.cpp b/libopie2/opiepim/core/otimezone.cpp index 34659c3..dab68af 100644 --- a/libopie2/opiepim/core/otimezone.cpp +++ b/libopie2/opiepim/core/otimezone.cpp | |||
@@ -1,14 +1,43 @@ | |||
1 | /* | ||
2 | This file is part of the Opie Project | ||
3 | Copyright (C) The Main Author <main-author@whereever.org> | ||
4 | =. Copyright (C) The Opie Team <opie-devel@handhelds.org> | ||
5 | .=l. | ||
6 | .>+-= | ||
7 | _;:, .> :=|. This program is free software; you can | ||
8 | .> <`_, > . <= redistribute it and/or modify it under | ||
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
10 | .="- .-=="i, .._ License as published by the Free Software | ||
11 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
12 | ._= =} : or (at your option) any later version. | ||
13 | .%`+i> _;_. | ||
14 | .i_,=:_. -<s. This program is distributed in the hope that | ||
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
16 | : .. .:, . . . without even the implied warranty of | ||
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
19 | ..}^=.= = ; Library General Public License for more | ||
20 | ++= -. .` .: details. | ||
21 | : = ...= . :.=- | ||
22 | -. .:....=;==+<; You should have received a copy of the GNU | ||
23 | -_. . . )=. = Library General Public License along with | ||
24 | -- :-=` this library; see the file COPYING.LIB. | ||
25 | If not, write to the Free Software Foundation, | ||
26 | Inc., 59 Temple Place - Suite 330, | ||
27 | Boston, MA 02111-1307, USA. | ||
28 | */ | ||
29 | |||
1 | #include <stdio.h> | 30 | #include <stdio.h> |
2 | #include <stdlib.h> | 31 | #include <stdlib.h> |
3 | 32 | ||
4 | #include <sys/types.h> | 33 | #include <sys/types.h> |
5 | 34 | ||
6 | #include "otimezone.h" | 35 | #include <opie2/otimezone.h> |
7 | 36 | ||
8 | namespace { | 37 | namespace Opie { |
9 | 38 | ||
10 | QDateTime utcTime( time_t t) { | 39 | QDateTime utcTime( time_t t) { |
11 | tm* broken = ::gmtime( &t ); | 40 | tm* broken = ::gmtime( &t ); |
12 | QDateTime ret; | 41 | QDateTime ret; |
13 | ret.setDate( QDate( broken->tm_year + 1900, broken->tm_mon +1, broken->tm_mday ) ); | 42 | ret.setDate( QDate( broken->tm_year + 1900, broken->tm_mon +1, broken->tm_mday ) ); |
14 | ret.setTime( QTime( broken->tm_hour, broken->tm_min, broken->tm_sec ) ); | 43 | ret.setTime( QTime( broken->tm_hour, broken->tm_min, broken->tm_sec ) ); |
@@ -56,12 +85,14 @@ namespace { | |||
56 | #warning "Need a replacement for MacOSX!!" | 85 | #warning "Need a replacement for MacOSX!!" |
57 | time_t ti = ::mktime( &broken ); | 86 | time_t ti = ::mktime( &broken ); |
58 | #endif | 87 | #endif |
59 | return ti; | 88 | return ti; |
60 | } | 89 | } |
61 | } | 90 | } |
91 | |||
92 | namespace Opie { | ||
62 | OTimeZone::OTimeZone( const ZoneName& zone ) | 93 | OTimeZone::OTimeZone( const ZoneName& zone ) |
63 | : m_name(zone) { | 94 | : m_name(zone) { |
64 | } | 95 | } |
65 | OTimeZone::~OTimeZone() { | 96 | OTimeZone::~OTimeZone() { |
66 | } | 97 | } |
67 | 98 | ||
@@ -108,6 +139,8 @@ OTimeZone OTimeZone::current() { | |||
108 | OTimeZone OTimeZone::utc() { | 139 | OTimeZone OTimeZone::utc() { |
109 | return OTimeZone("UTC"); | 140 | return OTimeZone("UTC"); |
110 | } | 141 | } |
111 | QString OTimeZone::timeZone()const { | 142 | QString OTimeZone::timeZone()const { |
112 | return m_name; | 143 | return m_name; |
113 | } | 144 | } |
145 | |||
146 | } | ||