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. General Programming
  3. C / C++ / MFC
  4. CFileStatus m_mtime problems

CFileStatus m_mtime problems

Scheduled Pinned Locked Moved C / C++ / MFC
8 Posts 3 Posters 0 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.
  • U Offline
    U Offline
    User 12497590
    wrote on last edited by
    #1

    Hy, i am using CFileStatus to get the date and time when the file was last modified. By some files time is one hour earlier or later, but only by some files? Does anybody have a clue why this happens?

    cfile.GetStatus(m_filepaths[i], m_status);

    Date=m_status.m_mtime.Format( "%d.%m.%Y %H:%M " );

    L J U 4 Replies Last reply
    0
    • U User 12497590

      Hy, i am using CFileStatus to get the date and time when the file was last modified. By some files time is one hour earlier or later, but only by some files? Does anybody have a clue why this happens?

      cfile.GetStatus(m_filepaths[i], m_status);

      Date=m_status.m_mtime.Format( "%d.%m.%Y %H:%M " );

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

      I would guess "summertime".

      Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

      U 1 Reply Last reply
      0
      • L Lost User

        I would guess "summertime".

        Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

        U Offline
        U Offline
        User 12497590
        wrote on last edited by
        #3

        Do you have any idea how to fix this?

        L 1 Reply Last reply
        0
        • U User 12497590

          Do you have any idea how to fix this?

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

          Not before you can confirm that it is broken; are the files that lack an hour created during the same period, or is it distributed randomly?

          Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

          U 1 Reply Last reply
          0
          • U User 12497590

            Hy, i am using CFileStatus to get the date and time when the file was last modified. By some files time is one hour earlier or later, but only by some files? Does anybody have a clue why this happens?

            cfile.GetStatus(m_filepaths[i], m_status);

            Date=m_status.m_mtime.Format( "%d.%m.%Y %H:%M " );

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

            The m_mtime.Format method returns a time formatted according to the local timezone, so it may well be one hour out. You should use one of the alternative methods (see CTime Class[^]) to get the absolute time.

            1 Reply Last reply
            0
            • U User 12497590

              Hy, i am using CFileStatus to get the date and time when the file was last modified. By some files time is one hour earlier or later, but only by some files? Does anybody have a clue why this happens?

              cfile.GetStatus(m_filepaths[i], m_status);

              Date=m_status.m_mtime.Format( "%d.%m.%Y %H:%M " );

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

              This can occur when files are stored on FAT file systems. NTFS stores all dates in UTC while FAT uses local times. The local time from FAT file systems is converted when getting the time. But this will return wrong values when the time stamp has been written by a system that uses a different time zone than the one used to read the time stamp. See also File Times (Windows)[^].

              1 Reply Last reply
              0
              • L Lost User

                Not before you can confirm that it is broken; are the files that lack an hour created during the same period, or is it distributed randomly?

                Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

                U Offline
                U Offline
                User 12497590
                wrote on last edited by
                #7

                I have a little bit check files. Files that where modified round in period betwen November and April have time one hour later.

                1 Reply Last reply
                0
                • U User 12497590

                  Hy, i am using CFileStatus to get the date and time when the file was last modified. By some files time is one hour earlier or later, but only by some files? Does anybody have a clue why this happens?

                  cfile.GetStatus(m_filepaths[i], m_status);

                  Date=m_status.m_mtime.Format( "%d.%m.%Y %H:%M " );

                  U Offline
                  U Offline
                  User 12497590
                  wrote on last edited by
                  #8

                  I have solved the Problem with this: Retrieving the Last-Write Time (Windows)[^]

                  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