utils/consoleRTC.h provides the following function to a console application:

  • s_console_rtc_cmds() :
    • settime hhmmss – sets the RTC time
    • setepoch secs – sets the RTC time by epoch time (seconds since 1.1.1970)
    • time – gets the RTC time
    • setdate ddmmyy – sets the RTC date
    • date – gets the RTC date

Note: The real time clock (RTC) has to be initialised in the in setup() function first, before it can be accessed by the console functions!

Syntax (examples)

#include "utils/consoleRTC.h"
. . .
. . .
s_console_string = s_console_rtc_cmds( s_console_string );


String s_console_string – String that holds the user command. Normally returned by s_console_routine() or a previous console function.


String : the user command or an empty String “” if the user command was recognised and processed by this function. (see of commands above)

Example Codes:

#include "consoleLogin.h"
#include "utils/consoleRTC.h"
void setup()
void loop()
  String s_console_string = s_console_routine();  

Notes and Warnings

This function and its commands might be helpful to test and learn how to work with the RTC that is embedded in the processor.

See the source code as example code for your own application:


In a ‘real world’ application, these functions might not be necessary or it might even be problematic to offer the end-user the opportunity to set the time and date of the device.

Please keep in mind that each included file and its used function increase the size of the resulting application. So in order to keep the application binaries as small as possible, include only functions that are really necessary for the final application.

An example can be found in the Arduino IDE menu:
File -> Examples -> Consoles -> Dev_Console

See also

DICE_GPS- Library
LowPowerSAMC- Library