File tree Expand file tree Collapse file tree 3 files changed +4
-4
lines changed
kotlin/src/main/kotlin/io/appwrite Expand file tree Collapse file tree 3 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ class ID {
9
9
static String _hexTimestamp() {
10
10
final now = DateTime.now();
11
11
final sec = (now.millisecondsSinceEpoch / 1000).floor();
12
- final usec = ( now.microsecondsSinceEpoch - sec) * 1000000;
12
+ final usec = now.microsecondsSinceEpoch - ( sec * 1000000) ;
13
13
return sec.toRadixString(16) +
14
14
usec.toRadixString(16).padLeft(5, '0');
15
15
}
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ namespace {{ spec.title | caseUcfirst }}
11
11
var now = DateTime.UtcNow;
12
12
var epoch = (now - new DateTime(1970, 1, 1));
13
13
var sec = (long)epoch.TotalSeconds;
14
- var usec = (long)(epoch.TotalMilliseconds * 1000);
14
+ var usec = (long)(( epoch.TotalMilliseconds * 1000) % 1000);
15
15
16
16
// Convert to hexadecimal
17
17
var hexTimestamp = sec.ToString("x") + usec.ToString("x").PadLeft(5, '0');
Original file line number Diff line number Diff line change @@ -11,9 +11,9 @@ class ID {
11
11
private fun hexTimestamp(): String {
12
12
val now = Instant.now()
13
13
val sec = now.epochSecond
14
- val usec = System.nanoTime() / 1000
14
+ val usec = ( System.nanoTime() / 1000) % 1000
15
15
16
- val hexTimestamp = "%08x%05x".format(sec, millis )
16
+ val hexTimestamp = "%08x%05x".format(sec, usec )
17
17
18
18
return hexTimestamp
19
19
}
You can’t perform that action at this time.
0 commit comments