Reputation: 105
I am using
MessageBox.Show(DateTime.Now.ToString());
to get date and time.
My problem is when I change system date it displays updated date not a real date.
what I need is real date and time not operating system's date and time.
please do help me.
Thank you.
Upvotes: 0
Views: 2453
Reputation: 4394
You could get the current time from some server over the internet like this for example: https://timezonedb.com/api
Maybe it's possible to get the time from the real time clock component on the motherboard, but the user could also just remove the CMOS battery or set the time in BIOS.
When you first run your program, save the current time to somewhere (hidden) on the disk, update that file every 15 minutes or so, and if the time is changing significantly like more than 1 hour, compare it to the file.
Otherwise there's no possible way to control this.
Upvotes: 1