473,765 Members | 2,058 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

64bit equivalent of VC++ time.h on linux?

I am working around a problem called Y2038 bug.
http://groups.google.co.in/group/com...16aaf1f50f863e

I am developing an application which need to be built both on windows
and linux and used time_t, ctime, mktime, localtime and gmtime
functions from <time.h>.

The application already exists and I have to replace these 32bit time
structures with their 64bit equivalents. I have made all the changes
and built the application on windows but can't do so on linux because
Linux does not seem to have a 64 bit equivalent for time_t , or
mktime..

http://msdn2.microsoft.com/en-us/library/bf12f0hc.aspx
Is there a patch or some workaround it? need suggestions
Thanks
Feb 11 '08 #1
9 7241
Aditi wrote:
I am working around a problem called Y2038 bug.
http://groups.google.co.in/group/com...16aaf1f50f863e

I am developing an application which need to be built both on windows
and linux and used time_t, ctime, mktime, localtime and gmtime
functions from <time.h>.
Since <time.his a standard C header, you may be trying too hard.
If you just let the compiler/library vendor worry about the proper
implementation, and do not rely on the fact that 'time_t' is a 32
bit signed number of seconds from January 1, 1970, you shouldn't
have to do anything.
The application already exists and I have to replace these 32bit time
structures with their 64bit equivalents.
Why do you think you have to? You just need a proper way of
calculating time differences instead of doing arithmetic directly
on the 'time_t' type.
I have made all the changes
and built the application on windows but can't do so on linux because
Linux does not seem to have a 64 bit equivalent for time_t , or
mktime..

http://msdn2.microsoft.com/en-us/library/bf12f0hc.aspx
Is there a patch or some workaround it? need suggestions
Thanks
Suggestion: don't.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Feb 11 '08 #2
* Victor Bazarov peremptorily fired off this memo:
Aditi wrote:
>I am working around a problem called Y2038 bug.
http://groups.google.co.in/group/com...16aaf1f50f863e

I am developing an application which need to be built both on windows
and linux and used time_t, ctime, mktime, localtime and gmtime
functions from <time.h>.

Since <time.his a standard C header, you may be trying too hard.
If you just let the compiler/library vendor worry about the proper
implementation, and do not rely on the fact that 'time_t' is a 32
bit signed number of seconds from January 1, 1970, you shouldn't
have to do anything.
>The application already exists and I have to replace these 32bit time
structures with their 64bit equivalents.

Why do you think you have to? You just need a proper way of
calculating time differences instead of doing arithmetic directly
on the 'time_t' type.
Also, on 64-bit systems (at least on my version of Linux), time_t is a
long int, and (for example) "date" and "cal" support years after 2038.
>I have made all the changes
and built the application on windows but can't do so on linux because
Linux does not seem to have a 64 bit equivalent for time_t , or
mktime..
Where did you get that idea? Look at the header files on a 64-bit linux
system.
>http://msdn2.microsoft.com/en-us/library/bf12f0hc.aspx
Is there a patch or some workaround it? need suggestions
Thanks

Suggestion: don't.

--
At Microsoft there are lots of brilliant ideas but the image is that they all
come from the top - I'm afraid that's not quite right.
-- Bill Gates
Feb 11 '08 #3
On Feb 11, 9:29 pm, Linonut <lino...@bollso uth.nutwrote:
* Victor Bazarov peremptorily fired off this memo:
Aditi wrote:
I am working around a problem called Y2038 bug.
http://groups.google.co.in/group/com...rowse_thread/t...
I am developing an application which need to be built both on windows
and linux and used time_t, ctime, mktime, localtime and gmtime
functions from <time.h>.
Since <time.his a standard C header, you may be trying too hard.
If you just let the compiler/library vendor worry about the proper
implementation, and do not rely on the fact that 'time_t' is a 32
bit signed number of seconds from January 1, 1970, you shouldn't
have to do anything.
The application already exists and I have to replace these 32bit time
structures with their 64bit equivalents.
Why do you think you have to? You just need a proper way of
calculating time differences instead of doing arithmetic directly
on the 'time_t' type.

Also, on 64-bit systems (at least on my version of Linux), time_t is a
long int, and (for example) "date" and "cal" support years after 2038.
I have made all the changes
and built the application on windows but can't do so on linux because
Linux does not seem to have a 64 bit equivalent for time_t , or
mktime..

Where did you get that idea? Look at the header files on a 64-bit linux
system.
>http://msdn2.microsoft.com/en-us/library/bf12f0hc.aspx
Is there a patch or some workaround it? need suggestions
Thanks
Suggestion: don't.

--
At Microsoft there are lots of brilliant ideas but the image is that they all
come from the top - I'm afraid that's not quite right.
-- Bill Gates

I am using a 32bit system, instead of using a third party library I
wanted to know if there is a patch aruond the existing system
libraries like time.h?
Feb 12 '08 #4
On Feb 11, 9:29 pm, Linonut <lino...@bollso uth.nutwrote:
* Victor Bazarov peremptorily fired off this memo:
Aditi wrote:
I am working around a problem called Y2038 bug.
http://groups.google.co.in/group/com...rowse_thread/t...
I am developing an application which need to be built both on windows
and linux and used time_t, ctime, mktime, localtime and gmtime
functions from <time.h>.
Since <time.his a standard C header, you may be trying too hard.
If you just let the compiler/library vendor worry about the proper
implementation, and do not rely on the fact that 'time_t' is a 32
bit signed number of seconds from January 1, 1970, you shouldn't
have to do anything.
The application already exists and I have to replace these 32bit time
structures with their 64bit equivalents.
Why do you think you have to? You just need a proper way of
calculating time differences instead of doing arithmetic directly
on the 'time_t' type.

Also, on 64-bit systems (at least on my version of Linux), time_t is a
long int, and (for example) "date" and "cal" support years after 2038.
I have made all the changes
and built the application on windows but can't do so on linux because
Linux does not seem to have a 64 bit equivalent for time_t , or
mktime..

Where did you get that idea? Look at the header files on a 64-bit linux
system.
>http://msdn2.microsoft.com/en-us/library/bf12f0hc.aspx
Is there a patch or some workaround it? need suggestions
Thanks
Suggestion: don't.

--
At Microsoft there are lots of brilliant ideas but the image is that they all
come from the top - I'm afraid that's not quite right.
-- Bill Gates
I am working on a 32-bit system and I was looking for patch around the
existing system libraries. Something like on this webpage?

I am not sure but what would this patch do?

http://linux.derkeiler.com/Mailing-L...5-11/6048.html
Feb 12 '08 #5
On 2008-02-12 05:16:27 -0500, James Kanze <ja*********@gm ail.comsaid:
(Boost
has support for time and dates, for example. I don't know
whether it's being considered for inclusion in the next standard
or not, however.)
A small part of it is currently in the draft standard, for use with the
threading library. The full Boost date-time library is slated for TR2,
which is not getting much work at the moment.

--
Pete
Roundhouse Consulting, Ltd. (www.versatilecoding.com) Author of "The
Standard C++ Library Extensions: a Tutorial and Reference
(www.petebecker.com/tr1book)

Feb 12 '08 #6
On Feb 12, 3:01 pm, "Victor Bazarov" <v.Abaza...@com Acast.netwrote:
James Kanze wrote:
[..]
I'm tempted to say that time in Unix (and thus in C/C++) is
broken
I am not certain why you would want to draw the conclusion
that if Unix time is broken, then so is C/C++ time. If you
rely on the time implementation specific to Unix, you have a
very simple case of platform specificity. The code as such is
non-portable and that's what the OP has, apparently.
The underlying principles of time in C/C++ are based on the Unix
model.

[...]
I suspect that he really should drop <time.hfor this.
The OP didn't say _for what_ he is using <time.h>. So, I would
not be as bold as to say he should drop it.
He did say that he needed dates beyond 2038. If he needs them
today, then the Unix/C/C++ model is not what he needs.

--
James Kanze (GABI Software) email:ja******* **@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientier ter Datenverarbeitu ng
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
Feb 12 '08 #7
On Feb 12, 2:14 pm, Rainer Lehrig <leh...@t-online.dewrote:
I would not worry about time.h
The width of the datafields might be changed when 2038 comes near.
The width of the data fields is already implementation
dependent, and varies over different machines I use. So you
can't use it today for anything external.

--
James Kanze (GABI Software) email:ja******* **@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientier ter Datenverarbeitu ng
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
Feb 12 '08 #8
* Aditi peremptorily fired off this memo:
I am not sure but what would this patch do?

http://linux.derkeiler.com/Mailing-L...5-11/6048.html
Barking up the wrong tree. Check this out instead:

http://www.ofx.net/

There's an open source library for it, libofx.

--
God is not willing to do everything, and thus take away our free will and that
share of glory which belongs to us.
-- Niccolo Machiavelli
Feb 13 '08 #9
Aditi wrote:
I am using a 32bit system, instead of using a third party library I
wanted to know if there is a patch aruond the existing system
libraries like time.h?
You can't just modify the runtime library since the kernel is also using
a 32-bit value for time_t (that is, the kernel _is_ using time_t, and
exports this to the userland, whereas on Windows, it probably is using
its own, different, time structures, and the Unixoid time_t is only used
in the library.)

Feb 20 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1240
by: Wen Jiang | last post by:
Hi, Has anyone been able to get pymat work on a 64bit linux system? I compiled the CVS version of pymat with python2.3/matlab7.01 on Mandrake10.1 64bit system, it can start the engine and use put/get function, but segfaults with eval function.
3
3248
by: Christian McArdle | last post by:
REQUEST FOR DISCUSSION (RFD) unmoderated group comp.os.ms-windows.programmer.64bit This is a formal Request For Discussion (RFD) to create comp.os.ms-windows.programmer.64bit as an unmoderated world-wide Usenet newsgroup dedicated to the discussion of Microsoft Windows 64-bit programming. This is not a Call for Votes (CFV); you cannot vote at this time. Procedural details appear below. All followup discussion should be crossposted to...
0
3147
by: Vijay Chegu | last post by:
Hi All, I am trying to port a perfectly working 32bit COM module developed in VC++ from 64bit. I am not able to generate .tlb file through midl compiler. I set the property thru the following. Property Pages->midl->output->Generate Type Library : Yes
2
6321
by: ramu | last post by:
Hi I have to call a vc++ function in a c program. suppose i have a function dword fun(dword arg1, bstr arg2); in vc++. I have to call this function in c. But I don't have dword datatype in c. So when i call this function in c, i have to convert all the data tpyes of vc++ into c data types. Or I must have equivalent data types
8
6149
by: dwelch91 | last post by:
I need to detect whether the operating system I am running on (not the Python version) is 64bit or 32bit. One requirement is that I need to include support for non-Intel/AMD architectures. The 2 ways I have thought detecting 64bit are: 1. struct.calcsize("P") == 8 2. '64' in os.uname() I'm not convinced that either one of these is really adequate. Does
18
3930
by: cman | last post by:
Hi guys, why does this fail raising bad_alloc int *v = new int ; if this succeeds int *v = (int *) malloc((unsigned)6000000000) both on the same machine, same compiler g++, 64bit linux red hat enterprise 4, no ulimits on the user, enough virtual memory ecc... in both cases compiled with
0
2990
by: Leo Park | last post by:
Hello, guys. I want to compile 32bit *.c and *.cc files On 64bit x86_64 systems. But, it is not work. --------------------------------------------------------------------------------------------------------------- bmk_mgr@ikdp101: gcc --version gcc (GCC) 3.4.3 20041212 (Red Hat 3.4.3-9.EL4)
1
3476
by: Morfys | last post by:
Hi, I would like to copy glibc/libgcc (in particular, libc.so. 6,libgcc_s.so.1) for a 32bit machine onto a 64bit machine. Would using the 32bit glibc/libgcc on the 64bit machine work? The reason I ask is that I've been getting the following error: Bin/libc.so.6: symbol _dl_out_of_memory, version GLIBC_PRIVATE not defined in file ld-linux.so.2 with link time reference
4
3297
by: legrape | last post by:
I am porting a piece of C code to 64bit on Linux. I am using 64bit integers. It is a floating point intensive code and when I compile (gcc) on 64 bit machine, I don't see any runtime improvement when optimizing -O3. If I construct a small program I can get significant (>4x) speed improvement using -O3 versus -g. If I compile on a 32 bit machine, it runs 5x faster on the 64 bit machine than does the 64bit compiled code. It seems like...
0
9568
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9399
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10163
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9957
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8832
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5423
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2806
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.