How to set system time in Windows 10 IoT?

后端 未结 8 2491
星月不相逢
星月不相逢 2020-12-31 05:12

Is there a way to set system time from my app running on a Raspberry Pi 2 in Windows 10 IoT Core Insider Preview?

This doesn\'t work for lack of kernel32.dll

<
8条回答
  •  既然无缘
    2020-12-31 06:06

    refer to Microsoft API Reference Docs and in the Windows.System namespace you can sets the system date and time with SetSystemDateTime method.

    but you must know it`s available in

    • Windows IoT Extension SDK (introduced v10.0.16225.0) and above

    you can use DateTimeSettings static class

    public static class DateTimeSettings
    

    then call SetSystemDateTime static method and send your object of DateTimeOffset type for setting date and time on Windows Iot.

    public static void SetSystemDateTime(DateTimeOffset utcDateTime)
    

    https://docs.microsoft.com/en-us/uwp/api/windows.system.datetimesettings

提交回复
热议问题