Time inconsistency in software

Discussion to talk about software related topics only.
Post Reply
Lachlanp
Posts: 91
Joined: Tue Jan 29, 2013 4:44 am

Time inconsistency in software

Post by Lachlanp »

I am using the standard EFFS-HTTP program. I set the time at GMT+3 hours using the code:

if ( SetTimeNTP() )
SetTimeZone( +3, 0 );
DisplaySystemTime();
This displays the time that exactly matches my PC Indicating the Netburner System Time and the PC are the same.

If I now store a file on the SD card, I get three different times depending on how I get it.

With the PC using FTP I get : 03/27/2013 7:56PM (Date created, modified, accessed are all the same)
Using the mtty console and selecting 'Display Directory' I get : 16:56:30 03/27/2013
Using the f_gettimedate function using the code exactly as it apears on page 49 of the EFFS_FAT262 manual i get: 16:56:30 03/27/2012.

The EFFS manual indicates the year should be calculated as follows:
year = ((date & 0xF800) >> 9) + 1980;
can i assume this is a mistake and I need to add 1981 instead of 1980? This would get the year correct.

Can I also assume that the time routines are returning the time as GMT (or UDT) and therefore I need to convert back to my time zone which is +3 hours? If so, is there an easy routine for this rather than trying to work out the 32 bit time and date code and making calculations?

Thanks
Lachlan
Post Reply