diff options
Diffstat (limited to 'src/util/test_time.c')
-rw-r--r-- | src/util/test_time.c | 262 |
1 files changed, 136 insertions, 126 deletions
diff --git a/src/util/test_time.c b/src/util/test_time.c index b46cac34d..cffa41de9 100644 --- a/src/util/test_time.c +++ b/src/util/test_time.c | |||
@@ -26,7 +26,7 @@ | |||
26 | 26 | ||
27 | 27 | ||
28 | int | 28 | int |
29 | main(int argc, char *argv[]) | 29 | main (int argc, char *argv[]) |
30 | { | 30 | { |
31 | struct GNUNET_TIME_Absolute now; | 31 | struct GNUNET_TIME_Absolute now; |
32 | struct GNUNET_TIME_AbsoluteNBO nown; | 32 | struct GNUNET_TIME_AbsoluteNBO nown; |
@@ -41,211 +41,221 @@ main(int argc, char *argv[]) | |||
41 | struct GNUNET_TIME_RelativeNBO reln; | 41 | struct GNUNET_TIME_RelativeNBO reln; |
42 | unsigned int i; | 42 | unsigned int i; |
43 | 43 | ||
44 | GNUNET_log_setup("test-time", "WARNING", NULL); | 44 | GNUNET_log_setup ("test-time", "WARNING", NULL); |
45 | forever = GNUNET_TIME_UNIT_FOREVER_ABS; | 45 | forever = GNUNET_TIME_UNIT_FOREVER_ABS; |
46 | relForever = GNUNET_TIME_UNIT_FOREVER_REL; | 46 | relForever = GNUNET_TIME_UNIT_FOREVER_REL; |
47 | relUnit = GNUNET_TIME_UNIT_MILLISECONDS; | 47 | relUnit = GNUNET_TIME_UNIT_MILLISECONDS; |
48 | zero.abs_value_us = 0; | 48 | zero.abs_value_us = 0; |
49 | 49 | ||
50 | last = now = GNUNET_TIME_absolute_get(); | 50 | last = now = GNUNET_TIME_absolute_get (); |
51 | while (now.abs_value_us == last.abs_value_us) | 51 | while (now.abs_value_us == last.abs_value_us) |
52 | now = GNUNET_TIME_absolute_get(); | 52 | now = GNUNET_TIME_absolute_get (); |
53 | GNUNET_assert(now.abs_value_us > last.abs_value_us); | 53 | GNUNET_assert (now.abs_value_us > last.abs_value_us); |
54 | 54 | ||
55 | /* test overflow checking in multiply */ | 55 | /* test overflow checking in multiply */ |
56 | rel = GNUNET_TIME_UNIT_MILLISECONDS; | 56 | rel = GNUNET_TIME_UNIT_MILLISECONDS; |
57 | GNUNET_log_skip(1, GNUNET_NO); | 57 | GNUNET_log_skip (1, GNUNET_NO); |
58 | for (i = 0; i < 55; i++) | 58 | for (i = 0; i < 55; i++) |
59 | rel = GNUNET_TIME_relative_multiply(rel, 2); | 59 | rel = GNUNET_TIME_relative_multiply (rel, 2); |
60 | GNUNET_log_skip(0, GNUNET_NO); | 60 | GNUNET_log_skip (0, GNUNET_NO); |
61 | GNUNET_assert(rel.rel_value_us == GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us); | 61 | GNUNET_assert (rel.rel_value_us == GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us); |
62 | /*check zero */ | 62 | /*check zero */ |
63 | rel.rel_value_us = (UINT64_MAX)-1024; | 63 | rel.rel_value_us = (UINT64_MAX) -1024; |
64 | GNUNET_assert(GNUNET_TIME_UNIT_ZERO.rel_value_us == | 64 | GNUNET_assert (GNUNET_TIME_UNIT_ZERO.rel_value_us == |
65 | GNUNET_TIME_relative_multiply(rel, 0).rel_value_us); | 65 | GNUNET_TIME_relative_multiply (rel, 0).rel_value_us); |
66 | 66 | ||
67 | /* test infinity-check for relative to absolute */ | 67 | /* test infinity-check for relative to absolute */ |
68 | GNUNET_log_skip(1, GNUNET_NO); | 68 | GNUNET_log_skip (1, GNUNET_NO); |
69 | last = GNUNET_TIME_relative_to_absolute(rel); | 69 | last = GNUNET_TIME_relative_to_absolute (rel); |
70 | GNUNET_assert(last.abs_value_us == GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us); | 70 | GNUNET_assert (last.abs_value_us == |
71 | GNUNET_log_skip(0, GNUNET_YES); | 71 | GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us); |
72 | GNUNET_log_skip (0, GNUNET_YES); | ||
72 | 73 | ||
73 | /* check relative to absolute */ | 74 | /* check relative to absolute */ |
74 | rel.rel_value_us = 1000000; | 75 | rel.rel_value_us = 1000000; |
75 | GNUNET_assert(GNUNET_TIME_absolute_get().abs_value_us < | 76 | GNUNET_assert (GNUNET_TIME_absolute_get ().abs_value_us < |
76 | GNUNET_TIME_relative_to_absolute(rel).abs_value_us); | 77 | GNUNET_TIME_relative_to_absolute (rel).abs_value_us); |
77 | /*check forever */ | 78 | /*check forever */ |
78 | rel.rel_value_us = UINT64_MAX; | 79 | rel.rel_value_us = UINT64_MAX; |
79 | GNUNET_assert(GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us == | 80 | GNUNET_assert (GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us == |
80 | GNUNET_TIME_relative_to_absolute(rel).abs_value_us); | 81 | GNUNET_TIME_relative_to_absolute (rel).abs_value_us); |
81 | /* check overflow for r2a */ | 82 | /* check overflow for r2a */ |
82 | rel.rel_value_us = (UINT64_MAX)-1024; | 83 | rel.rel_value_us = (UINT64_MAX) -1024; |
83 | GNUNET_log_skip(1, GNUNET_NO); | 84 | GNUNET_log_skip (1, GNUNET_NO); |
84 | last = GNUNET_TIME_relative_to_absolute(rel); | 85 | last = GNUNET_TIME_relative_to_absolute (rel); |
85 | GNUNET_log_skip(0, GNUNET_NO); | 86 | GNUNET_log_skip (0, GNUNET_NO); |
86 | GNUNET_assert(last.abs_value_us == GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us); | 87 | GNUNET_assert (last.abs_value_us == |
88 | GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us); | ||
87 | 89 | ||
88 | /* check overflow for relative add */ | 90 | /* check overflow for relative add */ |
89 | GNUNET_log_skip(1, GNUNET_NO); | 91 | GNUNET_log_skip (1, GNUNET_NO); |
90 | rel = GNUNET_TIME_relative_add(rel, rel); | 92 | rel = GNUNET_TIME_relative_add (rel, rel); |
91 | GNUNET_log_skip(0, GNUNET_NO); | 93 | GNUNET_log_skip (0, GNUNET_NO); |
92 | GNUNET_assert(rel.rel_value_us == GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us); | 94 | GNUNET_assert (rel.rel_value_us == GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us); |
93 | 95 | ||
94 | GNUNET_log_skip(1, GNUNET_NO); | 96 | GNUNET_log_skip (1, GNUNET_NO); |
95 | rel = GNUNET_TIME_relative_add(relForever, relForever); | 97 | rel = GNUNET_TIME_relative_add (relForever, relForever); |
96 | GNUNET_log_skip(0, GNUNET_NO); | 98 | GNUNET_log_skip (0, GNUNET_NO); |
97 | GNUNET_assert(rel.rel_value_us == relForever.rel_value_us); | 99 | GNUNET_assert (rel.rel_value_us == relForever.rel_value_us); |
98 | 100 | ||
99 | GNUNET_log_skip(1, GNUNET_NO); | 101 | GNUNET_log_skip (1, GNUNET_NO); |
100 | rel = GNUNET_TIME_relative_add(relUnit, relUnit); | 102 | rel = GNUNET_TIME_relative_add (relUnit, relUnit); |
101 | GNUNET_assert(rel.rel_value_us == 2 * relUnit.rel_value_us); | 103 | GNUNET_assert (rel.rel_value_us == 2 * relUnit.rel_value_us); |
102 | 104 | ||
103 | /* check relation check in get_duration */ | 105 | /* check relation check in get_duration */ |
104 | future.abs_value_us = now.abs_value_us + 1000000; | 106 | future.abs_value_us = now.abs_value_us + 1000000; |
105 | GNUNET_assert(GNUNET_TIME_absolute_get_difference(now, future).rel_value_us == | 107 | GNUNET_assert (GNUNET_TIME_absolute_get_difference (now, |
106 | 1000000); | 108 | future).rel_value_us == |
107 | GNUNET_assert(GNUNET_TIME_absolute_get_difference(future, now).rel_value_us == | 109 | 1000000); |
108 | 0); | 110 | GNUNET_assert (GNUNET_TIME_absolute_get_difference (future, |
111 | now).rel_value_us == | ||
112 | 0); | ||
109 | 113 | ||
110 | GNUNET_assert(GNUNET_TIME_absolute_get_difference(zero, forever).rel_value_us | 114 | GNUNET_assert (GNUNET_TIME_absolute_get_difference (zero, |
111 | == forever.abs_value_us); | 115 | forever).rel_value_us |
116 | == forever.abs_value_us); | ||
112 | 117 | ||
113 | past.abs_value_us = now.abs_value_us - 1000000; | 118 | past.abs_value_us = now.abs_value_us - 1000000; |
114 | rel = GNUNET_TIME_absolute_get_duration(future); | 119 | rel = GNUNET_TIME_absolute_get_duration (future); |
115 | GNUNET_assert(rel.rel_value_us == 0); | 120 | GNUNET_assert (rel.rel_value_us == 0); |
116 | rel = GNUNET_TIME_absolute_get_duration(past); | 121 | rel = GNUNET_TIME_absolute_get_duration (past); |
117 | GNUNET_assert(rel.rel_value_us >= 1000000); | 122 | GNUNET_assert (rel.rel_value_us >= 1000000); |
118 | 123 | ||
119 | /* check get remaining */ | 124 | /* check get remaining */ |
120 | rel = GNUNET_TIME_absolute_get_remaining(now); | 125 | rel = GNUNET_TIME_absolute_get_remaining (now); |
121 | GNUNET_assert(rel.rel_value_us == 0); | 126 | GNUNET_assert (rel.rel_value_us == 0); |
122 | rel = GNUNET_TIME_absolute_get_remaining(past); | 127 | rel = GNUNET_TIME_absolute_get_remaining (past); |
123 | GNUNET_assert(rel.rel_value_us == 0); | 128 | GNUNET_assert (rel.rel_value_us == 0); |
124 | rel = GNUNET_TIME_absolute_get_remaining(future); | 129 | rel = GNUNET_TIME_absolute_get_remaining (future); |
125 | GNUNET_assert(rel.rel_value_us > 0); | 130 | GNUNET_assert (rel.rel_value_us > 0); |
126 | GNUNET_assert(rel.rel_value_us <= 1000000); | 131 | GNUNET_assert (rel.rel_value_us <= 1000000); |
127 | forever = GNUNET_TIME_UNIT_FOREVER_ABS; | 132 | forever = GNUNET_TIME_UNIT_FOREVER_ABS; |
128 | GNUNET_assert(GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us == | 133 | GNUNET_assert (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us == |
129 | GNUNET_TIME_absolute_get_remaining(forever).rel_value_us); | 134 | GNUNET_TIME_absolute_get_remaining (forever).rel_value_us); |
130 | 135 | ||
131 | /* check endianess */ | 136 | /* check endianess */ |
132 | reln = GNUNET_TIME_relative_hton(rel); | 137 | reln = GNUNET_TIME_relative_hton (rel); |
133 | GNUNET_assert(rel.rel_value_us == GNUNET_TIME_relative_ntoh(reln).rel_value_us); | 138 | GNUNET_assert (rel.rel_value_us == GNUNET_TIME_relative_ntoh ( |
134 | nown = GNUNET_TIME_absolute_hton(now); | 139 | reln).rel_value_us); |
135 | GNUNET_assert(now.abs_value_us == GNUNET_TIME_absolute_ntoh(nown).abs_value_us); | 140 | nown = GNUNET_TIME_absolute_hton (now); |
141 | GNUNET_assert (now.abs_value_us == GNUNET_TIME_absolute_ntoh ( | ||
142 | nown).abs_value_us); | ||
136 | 143 | ||
137 | /* check absolute addition */ | 144 | /* check absolute addition */ |
138 | future = GNUNET_TIME_absolute_add(now, GNUNET_TIME_UNIT_SECONDS); | 145 | future = GNUNET_TIME_absolute_add (now, GNUNET_TIME_UNIT_SECONDS); |
139 | GNUNET_assert(future.abs_value_us == now.abs_value_us + 1000 * 1000LL); | 146 | GNUNET_assert (future.abs_value_us == now.abs_value_us + 1000 * 1000LL); |
140 | 147 | ||
141 | future = GNUNET_TIME_absolute_add(forever, GNUNET_TIME_UNIT_ZERO); | 148 | future = GNUNET_TIME_absolute_add (forever, GNUNET_TIME_UNIT_ZERO); |
142 | GNUNET_assert(future.abs_value_us == forever.abs_value_us); | 149 | GNUNET_assert (future.abs_value_us == forever.abs_value_us); |
143 | 150 | ||
144 | rel.rel_value_us = (UINT64_MAX)-1024; | 151 | rel.rel_value_us = (UINT64_MAX) -1024; |
145 | now.abs_value_us = rel.rel_value_us; | 152 | now.abs_value_us = rel.rel_value_us; |
146 | future = GNUNET_TIME_absolute_add(now, rel); | 153 | future = GNUNET_TIME_absolute_add (now, rel); |
147 | GNUNET_assert(future.abs_value_us == forever.abs_value_us); | 154 | GNUNET_assert (future.abs_value_us == forever.abs_value_us); |
148 | 155 | ||
149 | /* check zero */ | 156 | /* check zero */ |
150 | future = GNUNET_TIME_absolute_add(now, GNUNET_TIME_UNIT_ZERO); | 157 | future = GNUNET_TIME_absolute_add (now, GNUNET_TIME_UNIT_ZERO); |
151 | GNUNET_assert(future.abs_value_us == now.abs_value_us); | 158 | GNUNET_assert (future.abs_value_us == now.abs_value_us); |
152 | 159 | ||
153 | GNUNET_assert(forever.abs_value_us == | 160 | GNUNET_assert (forever.abs_value_us == |
154 | GNUNET_TIME_absolute_subtract(forever, | 161 | GNUNET_TIME_absolute_subtract (forever, |
155 | GNUNET_TIME_UNIT_MINUTES).abs_value_us); | 162 | GNUNET_TIME_UNIT_MINUTES). |
163 | abs_value_us); | ||
156 | /*check absolute subtract */ | 164 | /*check absolute subtract */ |
157 | now.abs_value_us = 50000; | 165 | now.abs_value_us = 50000; |
158 | rel.rel_value_us = 100000; | 166 | rel.rel_value_us = 100000; |
159 | GNUNET_assert(GNUNET_TIME_UNIT_ZERO_ABS.abs_value_us == | 167 | GNUNET_assert (GNUNET_TIME_UNIT_ZERO_ABS.abs_value_us == |
160 | (GNUNET_TIME_absolute_subtract(now, rel)).abs_value_us); | 168 | (GNUNET_TIME_absolute_subtract (now, rel)).abs_value_us); |
161 | rel.rel_value_us = 10000; | 169 | rel.rel_value_us = 10000; |
162 | GNUNET_assert(40000 == (GNUNET_TIME_absolute_subtract(now, rel)).abs_value_us); | 170 | GNUNET_assert (40000 == (GNUNET_TIME_absolute_subtract (now, |
171 | rel)).abs_value_us); | ||
163 | 172 | ||
164 | /*check relative divide */ | 173 | /*check relative divide */ |
165 | GNUNET_assert(GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us == | 174 | GNUNET_assert (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us == |
166 | (GNUNET_TIME_relative_divide(rel, 0)).rel_value_us); | 175 | (GNUNET_TIME_relative_divide (rel, 0)).rel_value_us); |
167 | 176 | ||
168 | rel = GNUNET_TIME_UNIT_FOREVER_REL; | 177 | rel = GNUNET_TIME_UNIT_FOREVER_REL; |
169 | GNUNET_assert(GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us == | 178 | GNUNET_assert (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us == |
170 | (GNUNET_TIME_relative_divide(rel, 2)).rel_value_us); | 179 | (GNUNET_TIME_relative_divide (rel, 2)).rel_value_us); |
171 | 180 | ||
172 | rel = GNUNET_TIME_relative_divide(relUnit, 2); | 181 | rel = GNUNET_TIME_relative_divide (relUnit, 2); |
173 | GNUNET_assert(rel.rel_value_us == relUnit.rel_value_us / 2); | 182 | GNUNET_assert (rel.rel_value_us == relUnit.rel_value_us / 2); |
174 | 183 | ||
175 | 184 | ||
176 | /* check Return absolute time of 0ms */ | 185 | /* check Return absolute time of 0ms */ |
177 | zero = GNUNET_TIME_UNIT_ZERO_ABS; | 186 | zero = GNUNET_TIME_UNIT_ZERO_ABS; |
178 | 187 | ||
179 | /* check GNUNET_TIME_calculate_eta */ | 188 | /* check GNUNET_TIME_calculate_eta */ |
180 | last.abs_value_us = GNUNET_TIME_absolute_get().abs_value_us - 1024; | 189 | last.abs_value_us = GNUNET_TIME_absolute_get ().abs_value_us - 1024; |
181 | forever = GNUNET_TIME_UNIT_FOREVER_ABS; | 190 | forever = GNUNET_TIME_UNIT_FOREVER_ABS; |
182 | forever.abs_value_us = forever.abs_value_us - 1024; | 191 | forever.abs_value_us = forever.abs_value_us - 1024; |
183 | GNUNET_assert(GNUNET_TIME_UNIT_ZERO_ABS.abs_value_us == | 192 | GNUNET_assert (GNUNET_TIME_UNIT_ZERO_ABS.abs_value_us == |
184 | GNUNET_TIME_calculate_eta(forever, 50000, 100000).rel_value_us); | 193 | GNUNET_TIME_calculate_eta (forever, 50000, |
194 | 100000).rel_value_us); | ||
185 | /* check zero */ | 195 | /* check zero */ |
186 | GNUNET_log_skip(1, GNUNET_NO); | 196 | GNUNET_log_skip (1, GNUNET_NO); |
187 | GNUNET_assert(GNUNET_TIME_UNIT_ZERO.rel_value_us == | 197 | GNUNET_assert (GNUNET_TIME_UNIT_ZERO.rel_value_us == |
188 | (GNUNET_TIME_calculate_eta(last, 60000, 50000)).rel_value_us); | 198 | (GNUNET_TIME_calculate_eta (last, 60000, 50000)).rel_value_us); |
189 | GNUNET_log_skip(0, GNUNET_YES); | 199 | GNUNET_log_skip (0, GNUNET_YES); |
190 | /*check forever */ | 200 | /*check forever */ |
191 | GNUNET_assert(GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us == | 201 | GNUNET_assert (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us == |
192 | (GNUNET_TIME_calculate_eta(last, 0, 50000)).rel_value_us); | 202 | (GNUNET_TIME_calculate_eta (last, 0, 50000)).rel_value_us); |
193 | 203 | ||
194 | /*check relative subtract */ | 204 | /*check relative subtract */ |
195 | now = GNUNET_TIME_absolute_get(); | 205 | now = GNUNET_TIME_absolute_get (); |
196 | rel.rel_value_us = now.abs_value_us; | 206 | rel.rel_value_us = now.abs_value_us; |
197 | relForever.rel_value_us = rel.rel_value_us + 1024; | 207 | relForever.rel_value_us = rel.rel_value_us + 1024; |
198 | GNUNET_assert(1024 == | 208 | GNUNET_assert (1024 == |
199 | GNUNET_TIME_relative_subtract(relForever, rel).rel_value_us); | 209 | GNUNET_TIME_relative_subtract (relForever, rel).rel_value_us); |
200 | /*check zero */ | 210 | /*check zero */ |
201 | GNUNET_assert(GNUNET_TIME_UNIT_ZERO.rel_value_us == | 211 | GNUNET_assert (GNUNET_TIME_UNIT_ZERO.rel_value_us == |
202 | GNUNET_TIME_relative_subtract(rel, relForever).rel_value_us); | 212 | GNUNET_TIME_relative_subtract (rel, relForever).rel_value_us); |
203 | /*check forever */ | 213 | /*check forever */ |
204 | rel.rel_value_us = UINT64_MAX; | 214 | rel.rel_value_us = UINT64_MAX; |
205 | GNUNET_assert(GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us == | 215 | GNUNET_assert (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us == |
206 | GNUNET_TIME_relative_subtract(rel, relForever).rel_value_us); | 216 | GNUNET_TIME_relative_subtract (rel, relForever).rel_value_us); |
207 | 217 | ||
208 | /*check GNUNET_TIME_relative_min */ | 218 | /*check GNUNET_TIME_relative_min */ |
209 | now = GNUNET_TIME_absolute_get(); | 219 | now = GNUNET_TIME_absolute_get (); |
210 | rel.rel_value_us = now.abs_value_us; | 220 | rel.rel_value_us = now.abs_value_us; |
211 | relForever.rel_value_us = rel.rel_value_us - 1024; | 221 | relForever.rel_value_us = rel.rel_value_us - 1024; |
212 | GNUNET_assert(relForever.rel_value_us == | 222 | GNUNET_assert (relForever.rel_value_us == |
213 | GNUNET_TIME_relative_min(rel, relForever).rel_value_us); | 223 | GNUNET_TIME_relative_min (rel, relForever).rel_value_us); |
214 | 224 | ||
215 | /*check GNUNET_TIME_relative_max */ | 225 | /*check GNUNET_TIME_relative_max */ |
216 | GNUNET_assert(rel.rel_value_us == | 226 | GNUNET_assert (rel.rel_value_us == |
217 | GNUNET_TIME_relative_max(rel, relForever).rel_value_us); | 227 | GNUNET_TIME_relative_max (rel, relForever).rel_value_us); |
218 | 228 | ||
219 | /*check GNUNET_TIME_absolute_min */ | 229 | /*check GNUNET_TIME_absolute_min */ |
220 | now = GNUNET_TIME_absolute_get(); | 230 | now = GNUNET_TIME_absolute_get (); |
221 | last.abs_value_us = now.abs_value_us - 1024; | 231 | last.abs_value_us = now.abs_value_us - 1024; |
222 | GNUNET_assert(last.abs_value_us == | 232 | GNUNET_assert (last.abs_value_us == |
223 | GNUNET_TIME_absolute_min(now, last).abs_value_us); | 233 | GNUNET_TIME_absolute_min (now, last).abs_value_us); |
224 | 234 | ||
225 | /*check GNUNET_TIME_absolute_max */ | 235 | /*check GNUNET_TIME_absolute_max */ |
226 | GNUNET_assert(now.abs_value_us == | 236 | GNUNET_assert (now.abs_value_us == |
227 | GNUNET_TIME_absolute_max(now, last).abs_value_us); | 237 | GNUNET_TIME_absolute_max (now, last).abs_value_us); |
228 | for (unsigned int i = 0; i < 30; i++) | 238 | for (unsigned int i = 0; i < 30; i++) |
229 | { | 239 | { |
230 | struct GNUNET_CONFIGURATION_Handle *cfg; | 240 | struct GNUNET_CONFIGURATION_Handle *cfg; |
231 | 241 | ||
232 | cfg = GNUNET_CONFIGURATION_create(); | 242 | cfg = GNUNET_CONFIGURATION_create (); |
233 | last = GNUNET_TIME_absolute_get_monotonic(cfg); | 243 | last = GNUNET_TIME_absolute_get_monotonic (cfg); |
234 | now = GNUNET_TIME_absolute_get_monotonic(cfg); | 244 | now = GNUNET_TIME_absolute_get_monotonic (cfg); |
235 | GNUNET_assert(now.abs_value_us > last.abs_value_us); | 245 | GNUNET_assert (now.abs_value_us > last.abs_value_us); |
236 | (void)GNUNET_TIME_absolute_get_monotonic(NULL); | 246 | (void) GNUNET_TIME_absolute_get_monotonic (NULL); |
237 | GNUNET_CONFIGURATION_set_value_string(cfg, | 247 | GNUNET_CONFIGURATION_set_value_string (cfg, |
238 | "util", | 248 | "util", |
239 | "MONOTONIC_TIME_FILENAME", | 249 | "MONOTONIC_TIME_FILENAME", |
240 | "monotonic-time.dat"); | 250 | "monotonic-time.dat"); |
241 | last = GNUNET_TIME_absolute_get_monotonic(cfg); | 251 | last = GNUNET_TIME_absolute_get_monotonic (cfg); |
242 | now = GNUNET_TIME_absolute_get_monotonic(cfg); | 252 | now = GNUNET_TIME_absolute_get_monotonic (cfg); |
243 | (void)GNUNET_TIME_absolute_get_monotonic(NULL); | 253 | (void) GNUNET_TIME_absolute_get_monotonic (NULL); |
244 | GNUNET_assert(now.abs_value_us > last.abs_value_us); | 254 | GNUNET_assert (now.abs_value_us > last.abs_value_us); |
245 | GNUNET_CONFIGURATION_destroy(cfg); | 255 | GNUNET_CONFIGURATION_destroy (cfg); |
246 | } | 256 | } |
247 | GNUNET_break(GNUNET_OK == | 257 | GNUNET_break (GNUNET_OK == |
248 | GNUNET_DISK_directory_remove("monotonic-time.dat")); | 258 | GNUNET_DISK_directory_remove ("monotonic-time.dat")); |
249 | 259 | ||
250 | return 0; | 260 | return 0; |
251 | } | 261 | } |