Commit a69466d7 authored by Sietse Ringers's avatar Sietse Ringers
Browse files

Make trailing newline in timestamps optional

parent ea64823a
......@@ -389,8 +389,12 @@ func readTimestamp(path string) (Timestamp, error) {
}
func parseTimestamp(bts []byte) (Timestamp, error) {
// Remove final character which is \n; convert from byte slice to string; parse as int
str, err := strconv.ParseInt(string(bts[:len(bts)-1]), 10, 64)
// Remove final character \n if present
if bts[len(bts)-1] == '\n' {
bts = bts[:len(bts)-1]
}
// convert from byte slice to string; parse as int
str, err := strconv.ParseInt(string(bts), 10, 64)
if err != nil {
return Timestamp(time.Unix(0, 0)), err
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment