File tree Expand file tree Collapse file tree 1 file changed +3
-14
lines changed Expand file tree Collapse file tree 1 file changed +3
-14
lines changed Original file line number Diff line number Diff line change @@ -262,20 +262,9 @@ uint64_t UuidGen::monotonic_timestamp() {
262
262
while (true ) {
263
263
uint64_t now = from_unix_timestamp (get_time_since_epoch_ms ());
264
264
uint64_t last = last_timestamp_.load ();
265
- if (now > last) {
266
- if (last_timestamp_.compare_exchange_strong (last, now)) {
267
- return now;
268
- }
269
- } else {
270
- uint64_t last_ms = to_milliseconds (last);
271
- if (to_milliseconds (now) < last_ms) {
272
- return last_timestamp_.fetch_add (1 );
273
- }
274
- uint64_t candidate = last + 1 ;
275
- if (to_milliseconds (candidate) == last_ms &&
276
- last_timestamp_.compare_exchange_strong (last, candidate)) {
277
- return candidate;
278
- }
265
+ uint64_t candidate = (now > last) ? now : last + 1 ;
266
+ if (last_timestamp_.compare_exchange_strong (last, candidate)) {
267
+ return candidate;
279
268
}
280
269
}
281
270
}
You can’t perform that action at this time.
0 commit comments