Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stuff next three nibbles of tv_sec into top of tv_nsec to fix y2038 #38

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nabijaczleweli
Copy link

The domain of the usec field is [0, 999999] which is [0, 0x000F423F], which leaves us the top three nibbles.
Thus, change the header format from

SSSSSSSS
UUUUUUUU
LLLLLLLL
sec = 0xSSSSSSSS
usec = 0xUUUUUUUU
len = LLLLLLLL

to

SSSSSSSS
sssUUUUU
LLLLLLLL
sec = 0xsssSSSSSSSS
usec = 0x000UUUUU
len = LLLLLLLL

this is fully-equivalent until y2038, and introduces a small-but-constant "error" to parsers that don't understand this in files recorded after y2038.

I provide samples of files recorded in 2050, 2100, 2150:

$ for f in *.ttyrec; do echo $f; od -txzZ -N32 $f; done
2050.ttyrec
0000000 969b2045 000d873a 0000007f 313f5b1b  >E ..:........[?1<
0000020 1b3d1b68 30323f5b 1b683430 6e3b305d  >h.=.[?2004h.]0;n<
0000040
2100.ttyrec
0000000 f4a7017f 0003e797 0000007f 313f5b1b  >.............[?1<
0000020 1b3d1b68 30323f5b 1b683430 6e3b305d  >h.=.[?2004h.]0;n<
0000040
2150.ttyrec
0000000 52b2e2d6 0016b69c 0000007f 313f5b1b  >...R.........[?1<
0000020 1b3d1b68 30323f5b 1b683430 6e3b305d  >h.=.[?2004h.]0;n<
0000040

2050.ttyrec.gz
2100.ttyrec.gz
2150.ttyrec.gz

Closes #37
Closes: Debian#1094187

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

susceptible to y2038 (inextricable from format)
1 participant