To show a PHPoC board’s built-in real-time clock (RTC) in a browser, have the board’s web server read the RTC and return an HTML page. On the PHPoC Blue used in the project, PHP can read the clock through /mmap/rtc0 with pid_open() and pid_ioctl(), or use the simpler date() function. JavaScript can refresh the displayed time each second; a form can send the browser’s local time back to the board when you choose to synchronize it.
What you need
- A PHPoC board with an RTC; the project uses a PHPoC Blue.
- Access to the board’s embedded web server and a browser that can reach it.
- A PHPoC server-side page to read the RTC and generate the display, plus client-side JavaScript to update the visible clock.
Sollae describes PHPoC Black and Blue boards as having a coin-battery-backed RTC and an embedded web server. Its platform overview also lists Ethernet or Wi-Fi, depending on the board, and RTC support. See Sollae’s device programming guide and PHPoC platform overview for platform details.
| # | Preview | Product | Price | |
|---|---|---|---|---|
| 1 |
|
Envistia Mall PHPoC Black P4S-341 Ethernet Wired LAN IoT Development Board | $67.50 | Buy on Amazon |
| 2 |
|
Development Boards & Kits - PIC / DSPIC PICkit 1 8/14P Flash | $25.00 | Buy on Amazon |
Read the RTC from PHPoC
For direct access to the RTC device, open /mmap/rtc0, request the date and weekday with pid_ioctl(), then close the device:
$pid = pid_open("/mmap/rtc0");
$date = pid_ioctl($pid, "get date");
$wday = pid_ioctl($pid, "get wday");
pid_close($pid);
The get date result is a date-and-time string, for example 20160720135607. The get wday result is an integer from 0 for Sunday through 6 for Saturday. Check the returned format when converting it for display; the example string uses year, month, day, hour, minute, and second in sequence. The exact calls and return formats are documented in Sollae’s device programming guide.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →#1 Best Overall
- PHP on Chip: PHPoC Black (P4S-341) is a wired LAN programmable IoT board by Sollae Systems, designed to make IoT development convenient. It uses PHPoC language for programming, easing the development process for users.
- Digital I/O and Other Interfaces: This IoT board comes with various interfaces to interact with sensors and actuators, supporting ADC, ARM, digital I/O, I2C, SPI, and UART, providing versatility for IoT development.
- Ethernet Connectivity: Equipped with Ethernet connectivity, PHPoC Black enables reliable data exchange over LAN, supporting network protocols like TCP/IP and WebSocket, enhancing its usability for IoT projects.
- Real-Time Clock: PHPoC Black includes a real-time clock (RTC) feature, allowing for accurate time-keeping and scheduling in your IoT applications, which is crucial for time-sensitive operations.
- High Security Standards: PHPoC Black supports various security protocols, authentication and encryption algorithms, ensuring the safety of your IoT devices and data on the web server.
Use date() for a formatted current time
If you only need a readable current date and time, PHPoC’s date() function uses the RTC when no timestamp is supplied:
$now = date("Y-m-d H:i:s");
For example, this produces a string such as 2026-10-02 14:30:00, with the actual value determined by the board’s clock when the page runs. Sollae’s date() reference says the function formats a supplied integer timestamp or, if none is given, the current time from the RTC.
Display the board time and browser time
The project serves a page from the PHPoC Blue and displays its RTC time alongside the browser’s local clock. PHP reads and formats the board time when it creates the page; JavaScript updates the displayed clocks once per second. This separates the two clocks clearly: the server-side value reflects the board RTC, while the browser-side value reflects the computer or device displaying the page. The original implementation is described in the Hackster project.
A basic implementation sequence is:
- Read the RTC in PHPoC PHP, using
date()or the lower-level/mmap/rtc0calls. - Insert the resulting board-time string into the HTML response so the page can display it.
- Use JavaScript to update the browser-local clock on a one-second interval.
- Keep the board and browser values labeled separately so users can see which clock they are comparing.
The project uses an ordinary web page and a form submission for synchronization. A WebSocket server is also part of the PHPoC platform, but the documented clock display does not require WebSockets; use that transport only if your application needs a persistent, interactive connection rather than periodic browser-side updates.
Synchronize the board RTC from the browser
In the project, the SYNC action submits the browser’s current time through a hidden form field named host_time_txt to clock_setup.php. That PHPoC handler opens the RTC device and writes the submitted value with pid_ioctl($pid_rtc, "set date $date"), then redirects the browser to the display page. See the project description for this flow.
This is a manual synchronization method: the browser is the time source, and the board changes its RTC only when the user submits the form. It is useful when the board’s clock needs correction and the browser’s local time is trusted. It does not establish automatic network time synchronization; use a separately configured time source if your deployment requires hands-off updates.
Account for RTC drift
A battery-backed RTC can keep the clock running when the board is not otherwise powered, but it does not guarantee perfect timekeeping. The project author reports that the clock may differ by a few minutes over a month and includes manual synchronization to keep the deviation small. That is an author’s observation, not a manufacturer accuracy specification or a guarantee for every board or environment. If accurate time matters to your application, check the clock periodically and decide whether manual correction is sufficient or a more automated time source is required.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

