3 ms·
A few quick code comments: Now().UnixNano() is not guaranteed to be monotonically increasing. I'd be more careful if your keys really do need to be unique. Yo
by Jabbles 11y ago
A few quick code comments:
Now().UnixNano() is not guaranteed to be monotonically increasing. I'd be more careful if your keys really do need to be unique.
You can use time.Truncate to get the 10 minute interval.
var t time.Time
t = start
for {
if t.After(stop) {
break
}
/* ... */
t = t.Add(d)
}
Would usually be written:
for t := start; !t.After(stop); t = t.Add(d) {
- akhenakh 11y agoIt's not actual code but notes for the simplicity of the blog post. Thanks for the advise I didn't know about Truncate.