I tried this in a private project and it seems to work fine. So I suggest to use this proceeding in Total Commander. I guess the option "1hourdif" then will not be needed in many cases.FileTimeToLocalFileTime uses the current settings for the time zone and daylight saving time. Therefore, if it is daylight saving time, this function will take daylight saving time into account, even if the time you are converting is in standard time. You can use the following sequence of functions as an alternative.
1.FileTimeToSystemTime
2.SystemTimeToTzSpecificLocalTime
3.SystemTimeToFileTime
Show file time independent of daylight saving setting
Moderators: Hacker, petermad, Stefan2, white
-
- Junior Member
- Posts: 5
- Joined: 2006-02-06, 09:47 UTC
Show file time independent of daylight saving setting
When the system time changes from daylight saving time to standard time, the file times change by 1 hour . Microsoft describes in MSDN how to detect the real time (independent of the current settings of daylight saving time):
- ghisler(Author)
- Site Admin
- Posts: 48949
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Unfortunately you will still get different results when the file is on a FAT32 drive than when it's on an NTFS drive. I guess that different functions need to be used depending on what file system the file is on. But even then there will be differences when the file was copied from one drive type to the other with Explorer or Total Commander.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
- fenix_productions
- Power Member
- Posts: 1979
- Joined: 2005-08-07, 13:23 UTC
- Location: Poland
- Contact:
Re: Show file time independent of daylight saving setting
2tcdailyuser
Would it be possible for you to write WDX plugin for that? Content plugins API is rather simple and it seems to me that you've got the most important part of the code alreadytcdailyuser wrote: I tried this in a private project and it seems to work fine.
"When we created the poke, we thought it would be cool to have a feature without any specific purpose." Facebook...
#128099
#128099
-
- Junior Member
- Posts: 5
- Joined: 2006-02-06, 09:47 UTC
I did a little test using my suggested algorithm: You are right, there are differences between file systems.ghisler(Author) wrote:Unfortunately you will still get different results when the file is on a FAT32 drive than when it's on an NTFS drive. I guess that different functions need to be used depending on what file system the file is on. But even then there will be differences when the file was copied from one drive type to the other with Explorer or Total Commander.
My results (the FAT32-Files have been copied from NTFS):
- - On NTFS the algorithm works fine.
- On FAT32 the algorithm works fine, when the system is in standard time.
- FAT32: When the system is in daylight saving time, the file time of ALL files have a difference of 1 hour.
Using current version of Total Commander, the displayed file times are equal (NTFS and FAT32) when the system is in standard time. In daylight saving time all file times differ by 1 hour. In all cases the time of some files is wrong:
- - NTFS: Those files which were changed in daylight saving time (now we have standard time) are displayed wrong (difference of 1 hour).
- NTFS: In summer the file times of files which where changed in winter will be wrong.
- FAT32: same behaviour like NTFS in standard time
- ghisler(Author)
- Site Admin
- Posts: 48949
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
The real problems occur when you copy a file in Explorer or TC during standard time, and then the time switches to daylight saving time, or vice versa.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
-
- Junior Member
- Posts: 5
- Joined: 2006-02-06, 09:47 UTC
What does "The real problems occur" mean? A difference of one hour? This problem we have in the current Total Commander version too.
(But you are right, this problem won't be solved with my suggestion when copying files from NTFS to FAT or vice versa. )
So only two advantages of my suggestion remain:
- displayed file times would not change when the system switches from standard to daylight saving time (or vice versa)
- the displayed file times on NTFS would be correct (at least if the file was not copied from FAT)
(But you are right, this problem won't be solved with my suggestion when copying files from NTFS to FAT or vice versa. )
So only two advantages of my suggestion remain:
- displayed file times would not change when the system switches from standard to daylight saving time (or vice versa)
- the displayed file times on NTFS would be correct (at least if the file was not copied from FAT)
- ghisler(Author)
- Site Admin
- Posts: 48949
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Exactly. You get the same time in some cases with my solution (which is the same as in Explorer), and some with yours, but there will still be cases with 1 hour difference in both. You could even get 2 hours and more when copying the file back+forth between NTFS and FAT (during different daylight saving periods).But you are right, this problem won't be solved with my suggestion when copying files from NTFS to FAT or vice versa.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com