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#
  4. How to get RTC(Real time clock) time using c#?

How to get RTC(Real time clock) time using c#?

Scheduled Pinned Locked Moved C#
questioncsharptutorial
4 Posts 2 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.
  • L Offline
    L Offline
    lovnin
    wrote on last edited by
    #1

    I want to get RTC(Real time clock) time in c#. How can i do that? Thank for your answer. :)

    S 1 Reply Last reply
    0
    • L lovnin

      I want to get RTC(Real time clock) time in c#. How can i do that? Thank for your answer. :)

      S Offline
      S Offline
      Simon P Stevens
      wrote on last edited by
      #2

      DateTime.Now

      Simon

      L 1 Reply Last reply
      0
      • S Simon P Stevens

        DateTime.Now

        Simon

        L Offline
        L Offline
        lovnin
        wrote on last edited by
        #3

        I think System.DateTime.Now is OS time not RTC time.

        S 1 Reply Last reply
        0
        • L lovnin

          I think System.DateTime.Now is OS time not RTC time.

          S Offline
          S Offline
          Simon P Stevens
          wrote on last edited by
          #4

          Where do you think the OS gets it's time from? The RTC is a bit of hardware that keeps track of the time while the PC is powered off. When the PC is powered on again, the time in the RTC is loaded and used by the OS. Depending on the OS, it may then rely on the RTC to count the time, and make a call to the hardware when over the time is needed, or it may keep track of the time using itself a software clock/counter. Either way, the value you get returned to you is the current time as far as the system as a whole is concerned. There is no need to distinguish between "OS time" and "RTC time" one is simply used to back the other. Unless you have a very strange and unusual requirement where you must have the actual hardware RTC value, just use DateTime.Now.

          Simon

          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