Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have compiled kernel 3.19.1 but still have a problem with time_t. Just simple program with cout << sizeof (time_t); gives size of 4 bytes, not 8 bytes as was my intention. Should I switch on a particular option during make menuconfig?
Yes, that is true. I have tested it with 32bit Linux and 32bit CPU.
Is it possible to patch the kernel and have long and time_t types with size of 8 bytes on 32bit CPU?
Maybe '64-bit kernel' option during make menuconfig should solve that issue?
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680
Rep:
I'm probably typing out of turn as I'm out of my depth here but a memory of trying to learn C and a google makes me think that time_t will be defined in the C libraries you link to so is that clib[or whatever]?
Please ignore, and sorry, if I am obviously ignorant.
Why would changing the kernel affect a user-space program? Are you specifying -m32 or -m64?
Not the kernel, but the architecture? My understanding is that on a 64 bit system, time_t is defined as 64 bits; on a 32 bit system it is 32 bits. That is how I read <bits/types.h> and <bits/typesizes.h>, but I could be wrong.
From another point of view, I've always read that the solution to the Unix/Linux "year 2037 problem" when the old time_t wraps around is the 64 bit architecture which has a bigger time_t.
Well, it is indeed a good alternative. Right now I have to make some software for x86 embedded platform which is of course 32bit architecture. It's only a little chance it will still run on 2038, but who knows... better to be prepared
Kernel defines what time_t is, standard C library just obeys, because it has no other choice.
You cannot patch a kernel to change time_t to 64-bit on x86 because that would change the ABI of a time syscall and in turn all of your user-space. To make that work youd have to rebuild your whole system starting from C library. And of course hunt all the bugs in applications where author assumed sizeof(time_t) == sizeof(long) or something similar.
Using Boost (or anything else) does not solve the problem of system time wrapping around 2038 on 32-bit systems.
PS. This might be a better fit for Programming forum.
Boost does not affect the system date and time_t of course, but solves the y2038 problem in my piece of code. That's enough for me.
In case of system time maybe here's a little hope: http://lwn.net/Articles/607741/
Last edited by neutrino-pl; 03-19-2015 at 12:39 PM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.