how to get real date (not system date) by c# or c++?

前端 未结 5 784
情歌与酒
情歌与酒 2021-01-13 12:49

Is it possible to get real date (not system date) without any connection to internet? I developed my application by C#. DateTime.Now gets system date but I want to know real

5条回答
  •  一整个雨季
    2021-01-13 13:26

    You can only do this if you know how much your system date varies from the "real date." If you have this delta in a TimeSpan object, you could then do create the "real date" by using DateTime.Now.Add(delta). If you don't have a network connection, you'll have to get the delta some other way, such as a user-entered value. This will be tough though, as the frequency of the system clock on a machine can vary.

提交回复
热议问题