Hi All,
NOTE: at first I thought of General Discussion then realise I do have C/C++ questions as well so please bear with me. Thank you.
I am a bit confused. I have seen a few posts here about there is no problems with Y2038 on a 32 bit Raspbian.
* viewtopic.php?t=326699
--> Kernel 5.10 and above is good to go until year 2486. Just checked one of my Pis and it's running kernel 5.10.63, so it's good.
* viewtopic.php?t=321612
--> The Linux kernel we use already uses 64bit numbers for time, so there are no issues with the kernel. As for third party applications, those are out of our control.
My problem is I cannot set date after Y2038 and date wraps around from Y2038 to Y1901 which contradicts some of the posts above. Can someone help me understand whats is going on? I am working on Pi and with our stuff, it needs long life and at the current point, I cannot use 64 bit OS and relevant 64 bit libraries; and we already spent 4 years of our lives developing stuff... so help please?
I am using Buster May 2023 and using the new Zero2 W. See details below.
So I am using system tools to change date and not third party tools.
Questions
1/ How do I set date after Y2038 and also get its date?
2/ Aren't the posts from links given contradict to what I see here on my Pi OS? Can someone un-confuse me, help please?
3.1/ In C / C++ code for my Bullseye (Buster? Well kernel is Bullseye...), the clock_gettime is a 32 bit function. When I try to access 64 bit time __time64_t there is none. Same goes with clock_gettime64 in my 32 bit OS that the compiler tells me no such function from the library.
3.2/ In to get millisecond equivalent but it is implemented as gettimeofday with CLOCK_REALTIME which is 32 bit even though the function returns int64_t...
3.3/ From bits and bobs above, with linkies above, I tried to be smart and since I do not know what I am doing... I even tried to force clock_gettime64 in my 32 bit OS by callingSo what is going and can someone help me understand please?
Many thanks in advance!
![Smile :)]()
NOTE: at first I thought of General Discussion then realise I do have C/C++ questions as well so please bear with me. Thank you.
I am a bit confused. I have seen a few posts here about there is no problems with Y2038 on a 32 bit Raspbian.
* viewtopic.php?t=326699
--> Kernel 5.10 and above is good to go until year 2486. Just checked one of my Pis and it's running kernel 5.10.63, so it's good.
* viewtopic.php?t=321612
--> The Linux kernel we use already uses 64bit numbers for time, so there are no issues with the kernel. As for third party applications, those are out of our control.
My problem is I cannot set date after Y2038 and date wraps around from Y2038 to Y1901 which contradicts some of the posts above. Can someone help me understand whats is going on? I am working on Pi and with our stuff, it needs long life and at the current point, I cannot use 64 bit OS and relevant 64 bit libraries; and we already spent 4 years of our lives developing stuff... so help please?
I am using Buster May 2023 and using the new Zero2 W. See details below.
Code:
Linux linux-newb 5.10.103-v7+ #1529 SMP Tue Mar 8 12:21:37 GMT 2022 armv7l GNU/Linux
Code:
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"NAME="Raspbian GNU/Linux"VERSION_ID="10"VERSION="10 (buster)"VERSION_CODENAME=busterID=raspbianID_LIKE=debianHOME_URL="http://www.raspbian.org/"SUPPORT_URL="http://www.raspbian.org/RaspbianForums"BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
Code:
$ sudo date -s "19 jan 2038 03:14:00"Tue 19 Jan 03:14:00 GMT 2038$ dateTue 19 Jan 03:14:02 GMT 2038... tick tock tick tock checking via $date$ dateTue 19 Jan 03:14:08 GMT 2038$ dateFri 13 Dec 20:45:52 GMT 1901
Questions
1/ How do I set date after Y2038 and also get its date?
2/ Aren't the posts from links given contradict to what I see here on my Pi OS? Can someone un-confuse me, help please?
3.1/ In C / C++ code for my Bullseye (Buster? Well kernel is Bullseye...), the clock_gettime is a 32 bit function. When I try to access 64 bit time __time64_t there is none. Same goes with clock_gettime64 in my 32 bit OS that the compiler tells me no such function from the library.
3.2/ In
Code:
int64_t current_time = vcos_getmicrosecs64()/1000
3.3/ From bits and bobs above, with linkies above, I tried to be smart and since I do not know what I am doing... I even tried to force clock_gettime64 in my 32 bit OS by calling
Code:
struct timespec xx { };struct timespec yy { };//syscall(SYS_clock_gettime64, CLOCK_REALTIME, &xx); // this line cannot work; no function in library so no compilesyscall(__NR_clock_gettime64, CLOCK_REALTIME, &yy); // this line works but always get 0 values...
Many thanks in advance!


Statistics: Posted by jmnemonic — Wed Feb 07, 2024 10:11 am