How to detect reset of RTC time in Windows 10

Tomas_86 0 Reputation points
2023-02-16T12:20:19.8633333+00:00

I have tablet that is used as Medical device where is running software that I am developing. I need have always actual time in my application.

Tablet do not contain CMOS battery so RTC time will restarted when batery is empty.

Tablet is aslo not connect to the internet so time synchronization via internet is not possible.

I need some notification from Windows to know that RTC time in BIOS was restarted. So I can ask user in me application to enter new time/date.

I suppoused that when RTC reset happened there will be default time and this default time will be used aslo in Windows but as I read for Windows 10 it does not work .

(https://learn.microsoft.com/en-us/troubleshoot/windows-client/shell-experience/changes-calendar-date-in-bios-not-reflected)

  1. Is there some background solution in Windows 10 how to know that RTC time was restarted ? ( some value in registry, some logs in windows,... )
  2. Is there some way how to use restarted RTC time in Windows 10 ?

During normal behaviour during Windows 10 startup:

if (RTC time > Windows system time) => RTC time us used in Windows

if (RTC time < Windows system time) => Windows keep system time and aslo set RTC time

  1. Is there some way how to block Windows 10 to set RTC time when RTC time was restarted ( or is older that Windows time) ? I tried to block service "Windows Time" but RTC time is still updated.

In this point I am thinking to disable time synchronization between RTC and Windows time and check directli this time to evaluate if RTC time was restarted (RTC time is older than Windows time)

  1. I found on internet that Windows use function "clock_systohc" to set RTC clock

(https://learn.microsoft.com/en-us/azure-sphere/reference/applibs-reference/applibs-rtc/function-clock-systohc)

Is there any way to know that this fuction was called ?

Thanks

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
12,077 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Limitless Technology 44,666 Reputation points
    2023-02-17T12:00:00+00:00

    Hi. Thank you for your question and reaching out. I’d be more than happy to help you with your query

    To detect a reset of the RTC time in Windows 10, you can use the Windows Event Log. To access the event log, press the Windows key and type "eventvwr.msc" into the search box. Once the Event Viewer is open, you can look for events with the source "Kernel-General" and the event ID "13". This event will be triggered when the RTC time is reset. Additionally, you can use the Windows API call GetSystemTime function to get the current system time, and compare it to the last known system time to determine if the RTC time was reset.

    If the reply was helpful, please don’t forget to upvote or accept as answer, thank you.

    0 comments No comments

  2. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.