mirror of
https://github.com/asciinema/asciinema.git
synced 2026-04-25 07:55:51 +03:00
[GH-ISSUE #322] why is timestamp an integer? #214
Labels
No labels
bug
compatibility
feature request
fit for beginners
help wanted
hosting
idea
improvement
packaging
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/asciinema#214
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @kilobyte on GitHub (Sep 28, 2018).
Original GitHub issue: https://github.com/asciinema/asciinema/issues/322
While adding asciicast support to termrec, I noticed that the "timestamp" field is supposed to be an integer — inconsistently with "duration" and event timestamps. Is there a reason for this?
It doesn't matter much in most cases, as humans care mostly about recording date — but I can think of scenarios where not losing the precision would be nice.
(And my direct reason is that it's an odd case in the testsuite for round-tripping between ttyrec and asciicast :p.)
@ku1ik commented on GitHub (Nov 16, 2018):
Hehe, I can see round-tripping problem :)
Yeah, the duration and event timestamps are floats, obviously.
The
timestampfield is like you figured only something that would be turned into a date for humans, so we never thought we would need sub-second precision here. So no, there's no specific reason for this.Since changing this would be a breaking change I'd rather not do this to v2. In practice it would probably be ok-ish, since neither
asciinema playnor asciinema web player use this field for anything, and they're written in dynamic languages, which would handle that the same way. I said "ok-ish" as I don't know all the other tools people built around this format (I know of svg-term-cli, and a bunch of others), and whether they would work.That could definitely be changed in v3 of the file format, although I don't see anything else which needs fixing in v2 to introduce v3 anytime soon.
@ku1ik commented on GitHub (Nov 17, 2018):
Actually it was supposed to be float: https://github.com/asciinema/asciinema/blob/develop/doc/asciicast-v2.md#duration
So it's been wrongly saved as integer :|
@kilobyte commented on GitHub (Nov 17, 2018):
termrec already accepts floats so that's nice. Should it produce them when writing an asciicast file?
@ku1ik commented on GitHub (Nov 17, 2018):
@kilobyte yes, let's go with floats here, since that's what was the intent, and what the v2 format doc says. I'll fix that in asciinema recorder too.
@ku1ik commented on GitHub (Nov 17, 2018):
@kilobyte ah, sorry. I looked wrong.
duration(which I linked above by mistake) is supposed to be float buttimestampis documented as integer, like I wrote yesterday. Sorry for confusion. In that case I'd rather stay with int...JSONDecodeError#411JSONDecodeError#1025