Created
December 30, 2025 04:17
-
-
Save xtaci/f01503b9167f9b520b8896682b67e14d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "testing" | |
| "time" | |
| ) | |
| func BenchmarkNow(b *testing.B) { | |
| var now uint32 | |
| for i := 0; i < b.N; i++ { | |
| now = currentMs() | |
| } | |
| _ = now | |
| } | |
| func currentMs() uint32 { | |
| return uint32(time.Now().UnixNano() / int64(time.Millisecond)) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment