File tree Expand file tree Collapse file tree 2 files changed +21
-3
lines changed Expand file tree Collapse file tree 2 files changed +21
-3
lines changed Original file line number Diff line number Diff line change 1
1
#include < cassert>
2
+ #include < filesystem>
2
3
#include < iostream>
3
4
#include < set>
4
5
#include < context.hpp>
8
9
#include < pini/pini.hpp>
9
10
#include < world_clock/gui.hpp>
10
11
#include < world_clock/io.hpp>
12
+ #include " world_clock/world_clock.hpp"
11
13
12
14
using namespace misc ;
13
15
@@ -111,13 +113,21 @@ class clock_ticker_t {
111
113
};
112
114
} // namespace
113
115
116
+ bool load_timezones (std::filesystem::path const & filename, world_clock_t & clock) {
117
+ pn::pini timezones;
118
+ if (!timezones.load_file (filename)) { return false ; }
119
+
120
+ for (auto & pair : timezones) {
121
+ std::cout << pair.first << " " << pair.second << ' \n ' ;
122
+ clock.add (pair.first , 0xff8800ff , timezones.get_double (pair.first ));
123
+ }
124
+ return true ;
125
+ }
114
126
int main () {
115
127
misc::context_t ctx (" World Clock" );
116
128
ctx.setVerticalSyncEnabled (true );
117
129
world_clock_t clock;
118
- clock.add (" PDT" , 0xff8800ff , -7 .0f );
119
- clock.add (" IST" , 0x44ddffff , 5 .5f );
120
- clock.add (" CET" , 0x11ee44ff , 2 .0f );
130
+ load_timezones (" src/timezones.pini" , clock);
121
131
std::cout << clock << ' \n ' ;
122
132
input_t input;
123
133
delta_time_t dt;
Original file line number Diff line number Diff line change
1
+ GMT=0
2
+ ECT=1
3
+ EET=2
4
+ MET=3
5
+ IST=5.3
6
+ PST=-8
7
+ EST=-5
8
+
You can’t perform that action at this time.
0 commit comments