Code RoomMillisecond timestamp treated as seconds
MediumPrep Room Coding #1763

Millisecond timestamp treated as seconds

Code reviewCode quality & reviewMid–Senior~25 min

Review this Go code that converts an incoming epoch timestamp to a time.

What a strong answer looks like

Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix, specific and kind.

0:00 of about 25 min
Mark a line and say what kind of problem it is.0 findings
1func toTime(epoch int64) time.Time {
2 return time.Unix(epoch, 0)
3}
4 
5func within(epoch int64, d time.Duration) bool {
6 return time.Since(toTime(epoch)) < d
7}
8 
9// payloads send 1700000000000 (millis)
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.