REGDIR /T : incorrect localization of time stamps

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,221
78
Albuquerque, NM
prospero.unm.edu
Code:
[C:\Bin\TCmd25]date /t
Thu 23/01/2020

[C:\Bin\TCmd25]regdir /t hkcu\control panel\desktop
2020-01-23 11:33 hkcu\control panel\desktop
2019-08-23 11:56  Colors
2020-01-10 16:31  WindowMetrics
2020-01-23 11:33  MuiCached

[C:\Bin\TCmd25]date 2020-07-01

[C:\Bin\TCmd25]regdir /t hkcu\control panel\desktop
2020-01-23 12:33 hkcu\control panel\desktop
2019-08-23 12:56  Colors
2020-01-10 17:31  WindowMetrics
2020-01-23 12:33  MuiCached

[C:\Bin\TCmd25]date 2020-01-23

[C:\Bin\TCmd25]regdir /t hkcu\control panel\desktop
2020-01-23 11:33 hkcu\control panel\desktop
2019-08-23 11:56  Colors
2020-01-10 16:31  WindowMetrics
2020-01-23 11:33  MuiCached

[C:\Bin\TCmd25]
I know that DIR does it this way for compatibility with CMD‌.EXE. But CMD‌.EXE doesn't have a REGDIR command. There's no reason to do it wrong for compatibility with a hypothetical bug in a nonexistent command!

While we're at it: How about a U suboption to not localize times? And a S to display seconds? So, for example:

Code:
C:\>regdir /t hkcu\control panel\desktop
2020-01-23 11:33  HKCU\control panel\desktop
2019-08-23 12:56    Colors
2020-01-23 11:33    MuiCached
2020-01-10 16:31    WindowMetrics

C:\>regdir /ts hkcu\control panel\desktop
2020-01-23 11:33:40 HKCU\control panel\desktop
2019-08-23 12:56:56   Colors
2020-01-23 11:33:39   MuiCached
2020-01-10 16:31:32   WindowMetrics

C:\>regdir /tsu hkcu\control panel\desktop
2020-01-23 18:33:40 HKCU\control panel\desktop
2019-08-23 18:56:56   Colors
2020-01-23 18:33:39   MuiCached
2020-01-10 23:31:32   WindowMetrics

C:\>
 
May 20, 2008
10,623
81
Syracuse, NY, USA
I see something even stranger. My own REGFIND.EXE has the option to show times (and only ONE routine to do so). When I compare it to REGDIR, some of the times agree and some disagree by an hour ... very odd.

Code:
v:\> regdir /t "hkcu\control panel\desktop"
2020-01-14 17:04 hkcu\control panel\desktop
2019-07-02 10:22  Colors
2019-07-02 10:22  PerMonitorSettings
2019-07-02 10:22    DELA11441RHZS2_11_07E3_BE^A2B878758221BC48A45EF0F70A4458CA
2019-09-25 15:57  WindowMetrics
2020-01-14 17:04  MuiCached

v:\> regfind "hkcu\control panel\desktop" /T
2020-01-14 17:04:35 HKCU\control panel\desktop
2019-07-02 11:22:36 HKCU\control panel\desktop\Colors
2019-07-02 11:22:40 HKCU\control panel\desktop\PerMonitorSettings
2019-07-02 11:22:40 HKCU\control panel\desktop\PerMonitorSettings\DELA11441RHZS2_11_07E3_BE^A2B878758221BC48A45EF0F70A4458CA
2019-09-25 16:57:17 HKCU\control panel\desktop\WindowMetrics
2020-01-14 17:04:34 HKCU\control panel\desktop\MuiCached
And, Charles, what are "/ts" and "/tsu"? They give me errors.

Code:
v:\> regdir /ts hkcu\control panel\desktop
TCC: (Sys) The parameter is incorrect.
 "ts"

v:\> regdir /tsu hkcu\control panel\desktop
TCC: (Sys) The parameter is incorrect.
 "tsu"
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,221
78
Albuquerque, NM
prospero.unm.edu
I see something even stranger. My own REGFIND.EXE has the option to show times (and only ONE routine to do so). When I compare it to REGDIR, some of the times agree and some disagree by an hour ... very odd.
That means your REGFIND is doing it right!

REGDIR gets it wrong if it's standard time and the timestamp is during Daylight Saving Time, or vice versa. Notice that the times where your two commands agree are in January — i.e. not DST, like today.

And, Charles, what are "/ts" and "/tsu"? They give me errors.
S and U are proposed suboptions for "show seconds" and "UTC times" respectively. REGDIR doesn't currently support them. I'm suggesting that some future version might.
 
May 20, 2008
10,623
81
Syracuse, NY, USA
That means your REGFIND is doing it right!

REGDIR gets it wrong if it's standard time and the timestamp is during Daylight Saving Time, or vice versa. Notice that the times where your two commands agree are in January — i.e. not DST, like today.



S and U are proposed suboptions for "show seconds" and "UTC times" respectively. REGDIR doesn't currently support them. I'm suggesting that some future version might.
It would seem that REGDIR is doing two different things at different times. REGFIND uses FileTimeToSystemTime() and SystemTimeToTzSpecificLocalTime().

Sorry, I missed the suggestion part.
 
May 20, 2008
10,623
81
Syracuse, NY, USA
It would seem that REGDIR is doing two different things at different times. REGFIND uses FileTimeToSystemTime() and SystemTimeToTzSpecificLocalTime().
Actually, it's my REGFIND that's doing two different things. SystemTimeToTzSpecificLocalTime is applying the standard time or daylight saving time
correction depending on the date of the time.