Skip to content
/ server Public

Commit b7e70e4

Browse files
refactored if to switch
1 parent 3566feb commit b7e70e4

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

mysys/my_uuid.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -252,17 +252,16 @@ int my_uuid_extract_ts(const char *uuid, my_time_t *seconds, ulong *usec)
252252
uint version= (uchar) uuid[6] >> 4;
253253
ulonglong ts;
254254

255-
if (version == 7)
255+
switch (version)
256256
{
257+
case 7:
257258
/* UUIDv7: bytes 0-5 are Unix timestamp in milliseconds (big-endian) */
258259
ts= mi_uint6korr(uuid);
259260
*seconds= ts / 1000;
260261
*usec= (ts % 1000) * 1000;
261262
return 1;
262-
}
263263

264-
if (version == 1)
265-
{
264+
case 1:
266265
/*
267266
UUIDv1: reconstruct 60-bit timestamp from three fields:
268267
- time_low (bytes 0-3): bits 0-31 of timestamp
@@ -282,8 +281,9 @@ int my_uuid_extract_ts(const char *uuid, my_time_t *seconds, ulong *usec)
282281
*seconds= ts / 1000000;
283282
*usec= ts % 1000000;
284283
return 1;
285-
}
286284

287-
/* Other versions (e.g., v4) don't contain timestamps */
288-
return 0;
285+
default:
286+
/* Other versions (e.g., v4) don't contain timestamps */
287+
return 0;
288+
}
289289
}

0 commit comments

Comments
 (0)