File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change 1
1
#include < cassert>
2
- #include < filesystem >
2
+ #include < cstdint >
3
3
#include < iostream>
4
4
#include < set>
5
5
#include < context.hpp>
@@ -113,13 +113,22 @@ class clock_ticker_t {
113
113
};
114
114
} // namespace
115
115
116
+ u32 random_number (u32 min, u32 max) {
117
+ std::random_device r;
118
+ std::default_random_engine re (r ());
119
+ std::uniform_int_distribution<u32 > uniform_dist (min, max);
120
+ return uniform_dist (re);
121
+ }
122
+
116
123
bool load_timezones (std::filesystem::path const & filename, world_clock_t & clock) {
117
124
pn::pini timezones;
118
125
if (!timezones.load_file (filename)) { return false ; }
119
126
120
127
for (auto & pair : timezones) {
121
- std::cout << pair.first << " " << pair.second << ' \n ' ;
122
- clock.add (pair.first , 0xff8800ff , timezones.get_double (pair.first ));
128
+ u32 color = random_number (255 , UINT32_MAX);
129
+ color |= 0xff ;
130
+ std::cout << pair.first << " " << pair.second << " " << std::hex << color << ' \n ' ;
131
+ clock.add (pair.first , color, timezones.get_double (pair.first ));
123
132
}
124
133
return true ;
125
134
}
You can’t perform that action at this time.
0 commit comments