Setting RTC Time

To set current time of RTC, "set date" command of pid_ioctl function is used.

pid_ioctl($pid, "set date TIME");

TIME is a string and the structure is as follows:

Division Year Month Day Hour Minute Second
Format YYYY MM DD hh mm ss
example 1 2000 01 03 03 05 07
example 2 2010 12 28 19 59 16

The following example shows how to set time.

example of setting RTC

<?php
$pid = pid_open("/mmap/rtc0");      // open RTC0
$date = "20160720135607";           // 13:56:07, 20th July, 2016
pid_ioctl($pid, "set date $date");  // set RTC time
pid_close($pid);
?>