Author Topic: Unix Time  (Read 3516 times)

Offline John

  • Forum Support / SB Dev
  • Posts: 3597
    • ScriptBasic Open Source Project
Unix Time
« on: December 16, 2018, 12:38:08 AM »
Quote
POSIX or "Unix time" is the number of seconds since UTC January 1, 1970, not counting leap seconds. The signed 32 bit implementation of the POSIX time system, used in Unix systems and embedded in countless applications, will overflow on 2038-01-19T3:14:08Z.

Humm, Should I care? ::)

Offline AIR

  • BASIC Developer
  • Posts: 932
  • Coder
Re: Unix Time
« Reply #1 on: December 16, 2018, 03:07:43 PM »
Quote
POSIX or "Unix time" is the number of seconds since UTC January 1, 1970, not counting leap seconds. The signed 32 bit implementation of the POSIX time system, used in Unix systems and embedded in countless applications, will overflow on 2038-01-19T3:14:08Z.

Humm, Should I care? ::)

In 2038, it will incapacitate our AI overlords,  and reset time itself to pre Global Warming days...hmm, maybe the SyFy Network should do an anthology series based on time resetting but people keeping their 2038 knowledge.....

Offline John

  • Forum Support / SB Dev
  • Posts: 3597
    • ScriptBasic Open Source Project
Re: Unix Time
« Reply #2 on: December 16, 2018, 03:41:56 PM »
Code: ScriptBasic
  1. PRINT TIMEVALUE(2050,1,1),"\n"
  2.  

(0): error &H31:The time is not valid, cannot be earlier than January 1, 1970. 00:00

It could be a problem for apps doing mortgages.

TIMEVALUE(), GMTIME and NOW are the only functions that come to mind that would break.
« Last Edit: December 16, 2018, 04:32:47 PM by John »

Offline John

  • Forum Support / SB Dev
  • Posts: 3597
    • ScriptBasic Open Source Project
Re: Unix Time
« Reply #3 on: December 17, 2018, 03:20:02 PM »
Quote
Linux uses a 64-bit time_t for 64-bit architectures only; the pure 32-bit ABI is not changed due to backward compatibility. There is ongoing work, mostly for embedded Linux systems, to support 64-bit time_t on 32-bit architectures, too.

The x32 ABI for Linux (which defines an environment for programs with 32-bit addresses but running the processor in 64-bit mode) uses a 64-bit time_t. Since it was a new environment, there was no need for special compatibility precautions.

AIR,

What is your guess it would take to use 64-bit time_t in SB?

Offline John

  • Forum Support / SB Dev
  • Posts: 3597
    • ScriptBasic Open Source Project
Re: Unix Time
« Reply #4 on: December 17, 2018, 03:26:43 PM »
My advice how to fix this is when 2038 rolls around, a new start date of January 1st 2000 would be used instead of January 1st 1970. This gives the 32 bit time_t a few more years.