Display time in a Windows Core IoT app with a clock

0 votes
So, I have built this Windows core IoT app running headless on a raspberry pi, but I'm unable to add a clock to display the updated time without making it too complex and heavy. Does anybody have a suggestion on how it can be done in a simple way keeping it in sync with the normal flow of time?
Please help!
Jul 10, 2018 in IoT (Internet of Things) by DataKing99
• 8,250 points
1,539 views

1 answer to this question.

0 votes
It is possible, but you should understand that a raspberry pi comes without a battery, so it won't be able to retain or save your current time. Hence, you'll always need to sync your raspberry pi to the internet for updating the date or the time.

Now, if your app is running headless on the raspbian, you will need to be connected to a visual unit, any kind of a monitor or display device, and have set data point to it. Now, on your headed app, configure a web page to display the clock and try setting up a timer that you can use to update the changes in time.
So, with that done, create and register a background task" on MSDN.

As for the timer declaration, this should be fine:

ThreadPoolTimer _clockTimer = null;

Now, for the timer initialization, this should do the trick:

_clockTimer = ThreadPoolTimer.CreatePeriodicTimer(_clockTimer_Tick, TimeSpan.FromMilliseconds(1000));

And finally, make sure to specify this to ensure that your timer is ticking regularly:

private void _clockTimer_Tick(ThreadPoolTimer timer)
{
    //Update your display. You can also use dispatcher if required
}

And if you need anything else on the same, you can refer to the ThreadPoolTimer documentation that I'm specifying below:

https://msdn.microsoft.com/en-us/library/windows/apps/xaml/windows.system.threading.threadpooltimer.aspx

Explore and see if you need something else time-related! :)
answered Jul 10, 2018 by nirvana
• 3,130 points

Related Questions In IoT (Internet of Things)

0 votes
1 answer

Configuring a Windows 10 IoT App for Automatic Restart

Have you tried using powershell right after ...READ MORE

answered Oct 10, 2018 in IoT (Internet of Things) by anonymous2
• 4,280 points
976 views
0 votes
1 answer

Access Serial Ports in Windows 10 IoT App

On Windows IoT you have to use ...READ MORE

answered Oct 10, 2018 in IoT (Internet of Things) by anonymous2
• 4,280 points
2,145 views
+1 vote
1 answer

Configuring Raspberry Pi with Windows 10 IoT App using Rest API

You should use HttpClient instead of WebClient. Try ...READ MORE

answered Oct 10, 2018 in IoT (Internet of Things) by anonymous2
• 4,280 points
916 views
0 votes
1 answer

Windows 10 IOT Core: real-time image processing DLL using C++

Yes, but it requires some work. The C++ ...READ MORE

answered Jan 28, 2019 in IoT (Internet of Things) by Upasana
• 8,620 points
1,713 views
0 votes
1 answer

Autostart published Application on Windows 10 IoT

It can be done by making changes ...READ MORE

answered Jul 13, 2018 in IoT (Internet of Things) by DataKing99
• 8,250 points
1,774 views
0 votes
1 answer

Application development in IoT

You can use AWS IoT with Amazon ...READ MORE

answered Aug 27, 2018 in IoT (Internet of Things) by anonymous2
• 4,280 points
610 views
0 votes
1 answer
0 votes
1 answer

Deploy my Windows 10 IOT core application locally!

Of course, you, can! That is, in ...READ MORE

answered Jul 17, 2018 in IoT (Internet of Things) by nirvana
• 3,130 points
1,087 views
0 votes
1 answer

Disk Management Commands in PowerShell for Windows IoT device

All libraries of the full .Net framework ...READ MORE

answered Nov 26, 2018 in IoT (Internet of Things) by nirvana
• 3,130 points
1,081 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP