Skip to content

32bit limit for unix timestamp / OpenBSD #3276

Closed
@hoppedmalt

Description

@hoppedmalt

Describe the bug
32bit limit for unix timestamps on OpenBSD, Y2038 bug

To Reproduce
Prebuilt jq from OpenBSD ports tree

user@testhost:~/build/jq-1.7.1$ echo '"2038-01-19T03:14:07Z"' | jq 'fromdate'            
2147483647
user@testhost:~/build/jq-1.7.1$ echo '"2038-01-19T03:14:08Z"' | jq 'fromdate'            
-2147483648

Locally built jq from jq source package

user@testhost:~/build/jq-1.7.1$ echo '"2038-01-19T03:14:07Z"' | ./jq 'fromdate'            
2147483647
user@testhost:~/build/jq-1.7.1$ echo '"2038-01-19T03:14:08Z"' | ./jq 'fromdate'            
-2147483648

Expected behavior
Positive integer representation of seconds since epoch should be printed in both cases.

user@macos ~ %  echo '"2038-01-19T03:14:08Z"' | jq 'fromdate'  
2147483648
[user@linux ~]$  echo '"2038-01-19T03:14:08Z"' | jq 'fromdate'  
2147483648

Environment (please complete the following information):

  • OS and Version: OpenBSD 7.6 amd64
  • jq version 1.7.1

Additional context
Behavior of jq is consistent with both, distribution supplied jq package and jq built from source.
Looks like tests check with date "2015-03-05T23:51:47Z". Test with 2045?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions