Caltime

From Nutwiki
Revision as of 17:02, 27 October 2016 by Harald (Talk | contribs) (1 revision imported)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

General Functions

This sample demonstrate several time and date features provided by Nut/OS. Furthermore, it can be used to setup the RTC hardware on your board, if available.

When started, the following output appears on the console.

Calendar Time 2.1 running on Nut/OS 5.0.5.0
Opening line editor...OK
Registering RTC hardware...OK

  0 - Display seconds counter
  1 - Display universal time
  2 - Display local time
  3 - Display system uptime
  C - Calculate weekday
  S - Set local time
  Y - Toggle DST calculation
  Z - Set timezone
What is thy bidding, my master?

Setting Date and Time

While Nut/OS internally uses universal time, caltime allows to enter the local time. Therefore, it is required to enter your local time zone first.

Press Z and enter the time deviation, given in hours and minutes offset to Greenwich Mean Time. By default it is set to +5:00 (Western America), for Central Europe set it to -1.

Enter time difference in format HH:MM: -1

Now press S to enter the current date and time in the requested format. The time must be entered in 24h format.

Enter date, use format YYYY/MM/DD  : 2012/10/12
Enter time, use 24h format HH:MM:SS: 16:22:30

Boards with RTC Hardware

On boards with RTC hardware, the following may be printed:

Registering RTC hardware...power failure

In this case, the RTC chip lost track of the date and time, probably caused by a failure of the backup power supply.

You can fix this by manually setting the local time.

See also