From 23ffd6c31933b859731c8b60485f656106ff90a4 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 27 Jan 2020 10:56:04 +0100 Subject: [PATCH] Kernel+LibC+Userland: Switch to 64-bit time_t Let's not have that 2038 problem people are talking about. :^) --- Kernel/FileSystem/DiskBackedFileSystem.cpp | 2 +- Kernel/UnixTypes.h | 2 +- Libraries/LibC/sys/types.h | 2 +- Libraries/LibC/time.h | 2 +- Userland/date.cpp | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Kernel/FileSystem/DiskBackedFileSystem.cpp b/Kernel/FileSystem/DiskBackedFileSystem.cpp index 4542c53914..65ae4754a8 100644 --- a/Kernel/FileSystem/DiskBackedFileSystem.cpp +++ b/Kernel/FileSystem/DiskBackedFileSystem.cpp @@ -33,7 +33,7 @@ //#define DBFS_DEBUG struct CacheEntry { - u32 timestamp { 0 }; + time_t timestamp { 0 }; u32 block_index { 0 }; u8* data { nullptr }; bool has_data { false }; diff --git a/Kernel/UnixTypes.h b/Kernel/UnixTypes.h index 162232062a..6b5492f7ac 100644 --- a/Kernel/UnixTypes.h +++ b/Kernel/UnixTypes.h @@ -294,7 +294,7 @@ struct sigaction { #define OFF_T_MAX 2147483647 typedef i32 off_t; -typedef u32 time_t; +typedef i64 time_t; struct utimbuf { time_t actime; diff --git a/Libraries/LibC/sys/types.h b/Libraries/LibC/sys/types.h index d6a99833c6..05cb15571e 100644 --- a/Libraries/LibC/sys/types.h +++ b/Libraries/LibC/sys/types.h @@ -56,7 +56,7 @@ typedef uint16_t mode_t; typedef uint32_t nlink_t; typedef uint32_t blksize_t; typedef uint32_t blkcnt_t; -typedef uint32_t time_t; +typedef int64_t time_t; typedef uint32_t useconds_t; typedef int32_t suseconds_t; typedef uint32_t clock_t; diff --git a/Libraries/LibC/time.h b/Libraries/LibC/time.h index feaf0b4c97..74f3baebb3 100644 --- a/Libraries/LibC/time.h +++ b/Libraries/LibC/time.h @@ -49,7 +49,7 @@ extern char* tzname[2]; extern int daylight; typedef uint32_t clock_t; -typedef uint32_t time_t; +typedef int64_t time_t; struct tm* localtime(const time_t*); struct tm* gmtime(const time_t*); diff --git a/Userland/date.cpp b/Userland/date.cpp index 79678af797..aa268666bb 100644 --- a/Userland/date.cpp +++ b/Userland/date.cpp @@ -33,7 +33,7 @@ int main(int argc, char** argv) time_t now = time(nullptr); if (argc == 2 && !strcmp(argv[1], "-u")) { - printf("%u\n", now); + printf("%lld\n", now); return 0; }