C++ time functions
Posted on 2011-09-09
I wrote a GUI application a long time ago using Borland Turbo C version 3. This ran happily on Win98SE and XP. With the jump to Windows 7, as it is a 16-bit application it will only run under XP mode (which it does).
I am now trying to bring it into the light so that it will run under w7 Ultimate (32-bit). To this end I have downloaded Microsoft Visual C++ 2010 Express. I have created a few console applications, but that isn't what I really want, so I have now converted it to a Win32 application.
The problem I now have is with the available time functions. All the functions I knew from UNIX and the Borland compiler seem to have disappeared. Some of the structures/variables still seem to be about, like time_t.
All I want to do is to be able to determine the difference in days between two dates. I have searched for this and have been reading a lot of posts in various places, but a lot still use the code that I recognise, like diffdate (or is it datediff)?. Either way I cannot access any such routine. The ctime.h header doesn't seem to exist under C++ 2010 (version 10.0).
I am finding the 'new' date routines very confusing to use, as every time I try something I get all kinds of errors about incompatible types.
Can someone point me in the right direction, preferably with example(s), so I can get on with converting the rest of the program - that needs the date difference to work?