How to set the system date/time?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • OtherOne

    How to set the system date/time?

    My system clock tends to lose (or sometimes gain) time and I am running some
    time critical processes so I need to keep the clock synchronized. I wrote
    the code to get the time from a time server but I can't find how to set the
    system time (DateTime.Now being read only).

    Any suggestions?

    Thanks,


  • OtherOne

    #2
    Re: How to set the system date/time?

    Found one solution, calling the SetSystemTime API function.

    Is there no .NET method of doing this?


    "OtherOne" <OtherOne@howdy .net> wrote in message
    news:bjllpk$mat @library2.airne ws.net...[color=blue]
    > My system clock tends to lose (or sometimes gain) time and I am running[/color]
    some[color=blue]
    > time critical processes so I need to keep the clock synchronized. I wrote
    > the code to get the time from a time server but I can't find how to set[/color]
    the[color=blue]
    > system time (DateTime.Now being read only).
    >
    > Any suggestions?
    >
    > Thanks,
    >
    >[/color]


    Comment

    • Robbie Harris

      #3
      Re: How to set the system date/time?

      not that i'm aware of, i've used the SetLocalTime api call before, and, in
      the vague interests of portability, i'd doubt this would become a framework
      call...

      r.

      "OtherOne" <OtherOne@howdy .net> wrote in message
      news:bjlo3u$j1u @library2.airne ws.net...[color=blue]
      > Found one solution, calling the SetSystemTime API function.
      >
      > Is there no .NET method of doing this?
      >
      >
      > "OtherOne" <OtherOne@howdy .net> wrote in message
      > news:bjllpk$mat @library2.airne ws.net...[color=green]
      > > My system clock tends to lose (or sometimes gain) time and I am running[/color]
      > some[color=green]
      > > time critical processes so I need to keep the clock synchronized. I[/color][/color]
      wrote[color=blue][color=green]
      > > the code to get the time from a time server but I can't find how to set[/color]
      > the[color=green]
      > > system time (DateTime.Now being read only).
      > >
      > > Any suggestions?
      > >
      > > Thanks,
      > >
      > >[/color]
      >
      >[/color]


      Comment

      Working...