Skip to content

update 32-bit architectures in the std lib to use 64-bit time to prepare for year 2038 #4726

Description

@andrewrk

Now that #4538 is done, it's zig std lib's turn to update. This task is to change time_t and related structs to be 64-bits and to call the 64-bit syscalls rather than the 32-bit ones. Here's a nice list of libc functions that have 64 bit versions:

andy@ark ~/D/musl> ls compat/time32/
adjtime32.c               gmtime32_r.c                         setitimer_time32.c
adjtimex_time32.c         localtime32.c                        settimeofday_time32.c
aio_suspend_time32.c      localtime32_r.c                      sigtimedwait_time32.c
clock_adjtime32.c         lstat_time32.c                       stat_time32.c
clock_getres_time32.c     lutimes_time32.c                     stime32.c
clock_gettime32.c         mktime32.c                           thrd_sleep_time32.c
clock_nanosleep_time32.c  mq_timedreceive_time32.c             time32.c
clock_settime32.c         mq_timedsend_time32.c                time32gm.c
cnd_timedwait_time32.c    mtx_timedlock_time32.c               time32.h
ctime32.c                 nanosleep_time32.c                   timerfd_gettime32.c
ctime32_r.c               ppoll_time32.c                       timerfd_settime32.c
difftime32.c              pselect_time32.c                     timer_gettime32.c
fstatat_time32.c          pthread_cond_timedwait_time32.c      timer_settime32.c
fstat_time32.c            pthread_mutex_timedlock_time32.c     timespec_get_time32.c
ftime32.c                 pthread_rwlock_timedrdlock_time32.c  utimensat_time32.c
futimens_time32.c         pthread_rwlock_timedwrlock_time32.c  utimes_time32.c
futimesat_time32.c        pthread_timedjoin_np_time32.c        utime_time32.c
futimes_time32.c          recvmmsg_time32.c                    wait3_time32.c
getitimer_time32.c        sched_rr_get_interval_time32.c       wait4_time32.c
getrusage_time32.c        select_time32.c                      __xstat.c
gettimeofday_time32.c     semtimedop_time32.c
gmtime32.c                sem_timedwait_time32.c

Any of these that match syscalls (or libc calls) that the zig std lib uses, should be upgraded.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    arch-arm32-bit Armarch-cskyCSKYarch-m68kMotorola 680x0 and ColdFirearch-mips32-bit MIPSarch-powerpc32-bit Power ISAarch-sparc32-bit SPARCarch-x8632-bit x86contributor friendlyThis issue is limited in scope and/or knowledge of Zig internals.enhancementSolving this issue will likely involve adding new logic or components to the codebase.os-linuxLinuxstandard libraryThis issue involves writing Zig code for the standard library.

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions