Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. Time Stamps Rendered by CMD.exe

Time Stamps Rendered by CMD.exe

Scheduled Pinned Locked Moved The Weird and The Wonderful
help
12 Posts 4 Posters 27 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D David A Gray

    I have conclusive proof of something that I have long suspected; file times for files that fall outside the current DST/Standard time period are reported off by 1 hour by the Windows command prompt (CMD.exe). I'll be publishing the proof later today.

    David A. Gray Delivering Solutions for the Ages, One Problem at a Time Interpreting the Fundamental Principle of Tabular Reporting

    J Offline
    J Offline
    Jochen Arndt
    wrote on last edited by
    #2

    Why do Explorer and the command prompt interpret file times differently? – The Old New Thing[^]

    D 1 Reply Last reply
    0
    • J Jochen Arndt

      Why do Explorer and the command prompt interpret file times differently? – The Old New Thing[^]

      D Offline
      D Offline
      David A Gray
      wrote on last edited by
      #3

      Thanks for the article citation. Nevertheless, since Windows has the transition date tables mentioned in the article, and NTFS stores UTC times on disk, I see no reason that it shouldn't be fixed, even if doing so required a new switch. After all, said switch could be set in the DIRCMD environment variable.

      David A. Gray Delivering Solutions for the Ages, One Problem at a Time Interpreting the Fundamental Principle of Tabular Reporting

      J 1 Reply Last reply
      0
      • D David A Gray

        Thanks for the article citation. Nevertheless, since Windows has the transition date tables mentioned in the article, and NTFS stores UTC times on disk, I see no reason that it shouldn't be fixed, even if doing so required a new switch. After all, said switch could be set in the DIRCMD environment variable.

        David A. Gray Delivering Solutions for the Ages, One Problem at a Time Interpreting the Fundamental Principle of Tabular Reporting

        J Offline
        J Offline
        Jochen Arndt
        wrote on last edited by
        #4

        Like the Unix linefeed mode support in Notepad that will be introduced after 30 years with the next Windows 10 version? That will be enabled by default but can be disabled with a registry key.

        D 1 Reply Last reply
        0
        • D David A Gray

          I have conclusive proof of something that I have long suspected; file times for files that fall outside the current DST/Standard time period are reported off by 1 hour by the Windows command prompt (CMD.exe). I'll be publishing the proof later today.

          David A. Gray Delivering Solutions for the Ages, One Problem at a Time Interpreting the Fundamental Principle of Tabular Reporting

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #5

          Hmmmm, Looking forward to you discovering File System Tunneling[^]. Report back and let us know what you've discovered. Start your research here[^]. :-D Best Wishes, -David Delaune

          D 1 Reply Last reply
          0
          • L Lost User

            Hmmmm, Looking forward to you discovering File System Tunneling[^]. Report back and let us know what you've discovered. Start your research here[^]. :-D Best Wishes, -David Delaune

            D Offline
            D Offline
            David A Gray
            wrote on last edited by
            #6

            Quarks, eh? ;) I didn't respond in the thread yesterday because I was using my phone to access my email, since the fiber cable to my house was down, due to a break in the last segment of the line. However, I managed to follow the link and read both articles, which were most intriguing. Eventually, I'll probably delve into it more. Meanwhile, I've run some tests in assorted scripting languages, with mixed results. So far, I've tested the stat() function, as implemented in Perl and PHP. Next come JavaScript, in the Node CLI, and VBScript, and, finally, PowerShell, which I anticipate will mirror the C# program that put the nail in the coffin. Now that I've learned all this, I think the resulting article will be a third installment in the Time Zone Lab series that I started a couple of years ago.

            David A. Gray Delivering Solutions for the Ages, One Problem at a Time Interpreting the Fundamental Principle of Tabular Reporting

            L 1 Reply Last reply
            0
            • J Jochen Arndt

              Like the Unix linefeed mode support in Notepad that will be introduced after 30 years with the next Windows 10 version? That will be enabled by default but can be disabled with a registry key.

              D Offline
              D Offline
              David A Gray
              wrote on last edited by
              #7

              Keep in mind that MS just finally "discovered" Linux. ;)

              David A. Gray Delivering Solutions for the Ages, One Problem at a Time Interpreting the Fundamental Principle of Tabular Reporting

              1 Reply Last reply
              0
              • D David A Gray

                Quarks, eh? ;) I didn't respond in the thread yesterday because I was using my phone to access my email, since the fiber cable to my house was down, due to a break in the last segment of the line. However, I managed to follow the link and read both articles, which were most intriguing. Eventually, I'll probably delve into it more. Meanwhile, I've run some tests in assorted scripting languages, with mixed results. So far, I've tested the stat() function, as implemented in Perl and PHP. Next come JavaScript, in the Node CLI, and VBScript, and, finally, PowerShell, which I anticipate will mirror the C# program that put the nail in the coffin. Now that I've learned all this, I think the resulting article will be a third installment in the Time Zone Lab series that I started a couple of years ago.

                David A. Gray Delivering Solutions for the Ages, One Problem at a Time Interpreting the Fundamental Principle of Tabular Reporting

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #8

                David A. Gray wrote:

                So far, I've tested the stat() function, as implemented in Perl and PHP. Next come JavaScript, in the Node CLI, and VBScript, and, finally, PowerShell, which I anticipate will mirror the C# program that put the nail in the coffin. Now that I've learned all this, I think the resulting article will be a third installment in the Time Zone Lab series that I started a couple of years ago.

                I expect that you will get the same results from Perl, PHP, Javascript, VBScript because all of those high-level languages will call into the GetFileAttributesEx Windows API to get file time stamps. The C lib function _stat() and all 32 bit variants are forwarded to GetFileAttributes The C lib function _stat64() and all 64 bit variants functions are forwarded to GetFileAttributesEx. GetFileAttributes simply forwards to GetFileAttributesEx Finally... GetFileAttributeEx calls into the NtQueryAttributesFile function[^] via a SYSCALL and then in kernelmode the request walks it's way through the filter drivers down to the filesystem driver. You are basically testing NtQueryAttributesFile function multiple times from the Thirteenth Floor. Those high level languages may format the date differently... but they are all getting the same timestamp from the filesystem layer. Best Wishes, -David Delaune

                D 1 Reply Last reply
                0
                • L Lost User

                  David A. Gray wrote:

                  So far, I've tested the stat() function, as implemented in Perl and PHP. Next come JavaScript, in the Node CLI, and VBScript, and, finally, PowerShell, which I anticipate will mirror the C# program that put the nail in the coffin. Now that I've learned all this, I think the resulting article will be a third installment in the Time Zone Lab series that I started a couple of years ago.

                  I expect that you will get the same results from Perl, PHP, Javascript, VBScript because all of those high-level languages will call into the GetFileAttributesEx Windows API to get file time stamps. The C lib function _stat() and all 32 bit variants are forwarded to GetFileAttributes The C lib function _stat64() and all 64 bit variants functions are forwarded to GetFileAttributesEx. GetFileAttributes simply forwards to GetFileAttributesEx Finally... GetFileAttributeEx calls into the NtQueryAttributesFile function[^] via a SYSCALL and then in kernelmode the request walks it's way through the filter drivers down to the filesystem driver. You are basically testing NtQueryAttributesFile function multiple times from the Thirteenth Floor. Those high level languages may format the date differently... but they are all getting the same timestamp from the filesystem layer. Best Wishes, -David Delaune

                  D Offline
                  D Offline
                  David A Gray
                  wrote on last edited by
                  #9

                  The problem with that theory, which has already born fruit, is that all of those functions retrieve a UTC time stamp. The issue is what happens on the 12th floor when the runtime that got the ball rolling converts the returned time stamp to local time. The outcome depends on whether they take into account the actual date and the DST transition dates on either side of it. Some frameworks take the same dumb approach implemented by CMD.exe, which treats all times as if they were in the current transition (DST vs. Standard Time). So far, I've already found two other frameworks (Perl and VBScript) that take that naieve approach.

                  David A. Gray Delivering Solutions for the Ages, One Problem at a Time Interpreting the Fundamental Principle of Tabular Reporting

                  L 1 Reply Last reply
                  0
                  • D David A Gray

                    The problem with that theory, which has already born fruit, is that all of those functions retrieve a UTC time stamp. The issue is what happens on the 12th floor when the runtime that got the ball rolling converts the returned time stamp to local time. The outcome depends on whether they take into account the actual date and the DST transition dates on either side of it. Some frameworks take the same dumb approach implemented by CMD.exe, which treats all times as if they were in the current transition (DST vs. Standard Time). So far, I've already found two other frameworks (Perl and VBScript) that take that naieve approach.

                    David A. Gray Delivering Solutions for the Ages, One Problem at a Time Interpreting the Fundamental Principle of Tabular Reporting

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #10

                    Hi, There use to be some amazing articles on the internet back in the 1990's that had charts and listed all the differences between the programming languages and how the handle date/time conversions. I briefly searched but could not find those old articles. Even Dr. Dobbs[^] has retired. I think it's a great idea to write an article about those differences. Looking forward to reading what you come up with. Best Wishes, -David Delaune

                    1 Reply Last reply
                    0
                    • D David A Gray

                      I have conclusive proof of something that I have long suspected; file times for files that fall outside the current DST/Standard time period are reported off by 1 hour by the Windows command prompt (CMD.exe). I'll be publishing the proof later today.

                      David A. Gray Delivering Solutions for the Ages, One Problem at a Time Interpreting the Fundamental Principle of Tabular Reporting

                      D Offline
                      D Offline
                      DaveAuld
                      wrote on last edited by
                      #11

                      How does PowerShell compare?

                      Dave Find Me On:Web|Youtube|Facebook|Twitter|LinkedIn Folding Stats: Team CodeProject

                      D 1 Reply Last reply
                      0
                      • D DaveAuld

                        How does PowerShell compare?

                        Dave Find Me On:Web|Youtube|Facebook|Twitter|LinkedIn Folding Stats: Team CodeProject

                        D Offline
                        D Offline
                        David A Gray
                        wrote on last edited by
                        #12

                        I haven't gotten to PowerShell, per se. However, since it runs atop the .NET Framework, I expect it to exhibit the same (correct) behavior as my test program. Hence, between that and the fact that I seldom use PowerShell, I wasn't planning a separate evaluation of it.

                        David A. Gray Delivering Solutions for the Ages, One Problem at a Time Interpreting the Fundamental Principle of Tabular Reporting

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups