NEQTO Docs
  • Languages iconEnglish
    • 日本語
  • Docs
  • API
  • FAQ

›neqto.js

Getting Started

  • NEQTO Hello World!
  • Tutorial Step 1. NEQTO Console Setting
  • Tutorial Step 2. Device Settings & Launching Service (NEQTO Bridge)
  • Tutorial Step 2. Device Settings & Launching Service (STM32 Discovery)
  • Tutorial Step 2. Device Settings & Launching Service (SPRESENSE)
  • Tutorial Step 3. Application development using scripts

NEQTO

  • NEQTO Account Registration
  • Sub-accounts
  • API Usage
  • NEQTO CloudSync for GCP
  • NEQTO Engine Firmware List
  • Support Guidelines

NEQTO Console

  • Introduction
  • Fundamentals
  • Administrative Actions
  • Device Management
  • Linux-based Device Management
  • Batch Registration
  • Scripts
  • Actions and Contacts
  • View Data from the Console
  • NEQTO Apps

    • About NEQTO Apps
    • NEQTO Infinitypool
    • NEQTO Insights
    • NEQTO Custodia
    • NEQTO Flow
  • Machine Driver
  • Recommended Browsers
  • Billing Information

SPRESENSE

    Hardware Specifications

    • 01. About Spresense

    Software Specifications

    • 01. Operational Flow
    • 02. Initial Installation
    • 03. Spresense Wi-Fi Initial Setup
    • 04. Spresense LTE-M Initial Setup
    • 05. Debug Log Acquisition
    • 06. System LED Indications
    • 07. Event Messages
    • 08. Updating Firmware

    neqto.js

    • 01. About neqto.js
    • 02. Log
    • 03. Timers
    • 04. HTTP
    • 05. HTTPS
    • 06. MQTT
    • 07. Secure
    • 08. Storage
    • 09. Sleep
    • 10. RTC
    • 11. GPIO
    • 12. UART
    • 13. SPI
    • 14. I2C
    • 15. ADC
    • 16. GNSS
    • 17. Camera
    • 18. Utils
    • 19. nqSpresense
    • 20. nqService
    • 21. nqMqtt
    • 22. nqFOTA
    • 23. nqWiFi
    • 24. nqLte

STM32 Discovery

    Hardware Specifications

    • 01. About STM32 Discovery Kit (B-L4S5I-IOT01A)

    Software Specifications

    • 01. Operational Flow
    • 02. Initial Installation
    • 03. STM32 Discovery Wi-Fi Initial Setup
    • 04. Debug Log Acquisition
    • 05. System LED Indications
    • 06. Event Messages
    • 07. Updating Firmware

    neqto.js

    • 01. About neqto.js
    • 02. Log
    • 03. Timers
    • 04. HTTP
    • 05. HTTPS
    • 06. MQTT
    • 07. Secure
    • 08. Storage
    • 09. Sleep
    • 10. RTC
    • 11. UserSW
    • 12. GPIO
    • 13. UART
    • 14. SPI
    • 15. I2C
    • 16. ADC
    • 18. Utils
    • 19. nqDiscovery
    • 20. nqService
    • 21. nqMqtt
    • 22. nqFOTA
    • 23. nqWiFi

NEQTO Bridge

    Hardware Specifications

    • 01. NEQTO Bridge Module
    • 02. NEQTO Bridge Wi-Fi Module
    • 03. NEQTO Bridge LTE-1 Module
    • 04. NEQTO Bridge LTE-M/NB Module
    • 05. NEQTO Bridge IO Board
    • 06. NEQTO Bridge Digital IO Board
    • 07. NEQTO Bridge Connector Board

    Software Specifications

    • 01. Operational Flow
    • 02. NEQTO Bridge Wi-Fi Module Initial Setup
    • 03. NEQTO Bridge LTE Module Initial Setup
    • 04. Debug Log Acquisition
    • 05. System LED Indications
    • 06. Event Messages
    • 07. Updating Firmware

    neqto.js

    • 01. About neqto.js
    • 02. Log
    • 03. Timers
    • 04. HTTP
    • 05. HTTPS
    • 06. MQTT
    • 07. Secure
    • 08. Storage
    • 09. Sleep
    • 10. RTC
    • 11. UserSW
    • 12. GPIO
    • 13. UART
    • 14. SPI
    • 15. I2C
    • 16. ADC
    • 17. BLE
    • 18. Utils
    • 19. nqBridge
    • 20. nqService
    • 21. nqMqtt
    • 22. nqFOTA
    • 23. nqWiFi
    • 24. nqLte
    • 25. nqLAN
    • 26. nqEx

Linux-based device

    Software Specifications

    • 01. System Requirements
    • 02. Installation
    • 03. Software Configurations
    • 04. Operational Flow
    • 05. Debug Log Acquisition
    • 06. Event Messages
    • 07. Updating Software

    neqto.js

    • 01. About neqto.js
    • 02. Log
    • 03. Timers
    • 04. HTTP
    • 05. HTTPS
    • 06. MQTT
    • 07. Secure
    • 08. Storage
    • 09. RTC
    • 10. UNIXSocket
    • 11. FileSystem
    • 12. SubProcess
    • 13. Utils
    • 14. nqLinux
    • 15. nqService
    • 16. nqMqtt
    • 17. nqFOTA
    • 18. nqLAN

neqto.js Libraries

  • About neqto.js Libraries
  • UART

    • GM65 Barcode Reader
    • SRF Ultrasonic Range Finder - Serial Mode

    I2C

    • HTS221 v2 Temperature and Humidity Sensor
    • LIS2DW12 v2 Accelerometer
    • SRF Ultrasonic Range Finder - I2C Mode
    • [Archive] HTS221 Temperature and Humidity Sensor
    • [Archive] LIS2DW12 Accelerometer

    Utils

    • RTC Alarm Synchronized Scheduler

    Integration

    • AWS S3 v2
    • AWS IoT Core v2
    • Azure IoT v2
    • GCP IoT Core
    • [Archive] AWS S3
    • [Archive] AWS IoT Core

neqto.js Snippets

  • About neqto.js Snippets
  • DataDog
  • Dropbox
  • Google Sheets
  • InfluxDB
  • Oracle Cloud Object Storage
  • Salesforce
  • SAP Cloud Platform Internet of Things
  • Splunk
  • Niagara

Release Notes

  • NEQTO Console Updates
  • NEQTO Firmware (Bridge Wi-Fi/LTE Module) Releases
  • NEQTO Firmware (STM32 Discovery Wi-Fi) Releases
  • NEQTO Firmware (Spresense Wi-Fi/LTE-M) Releases
  • NEQTO Engine for Linux Releases

10. RTC

The rtc object is a built-in object that provides the RTC alarm function.

Functional overview:

  • Provides a function to raise an alarm event at a specified time.
  • Provides a function related to system time.

Limitations:

  • Only one alarm can be used.



rtc Global Object

Methods()/PropertiesSummaryVersionNote
rtc.setAlarm()Sets the alarm occurrence time.00.00.15+
rtc.stopAlarm()Releases the alarm.00.00.15+
rtc.getInitTimeCorrVal()Gets the correction value after time synchronization for timestamp values acquired when the system time was not yet set.02.00.00+



Details

rtc.setAlarm(rtcAlarm[,callback])

Sets the alarm occurrence time.
Executes callback processing when an alarm occurs.
The alarm continues until it is stopped.
This method does not allow multiple simultaneous uses.
If you want to set another time, you need to release it once.

NameTypeM/OSummaryNote
rtcAlarmObjectmandatoryAlarm occurrence time setting
hour : {number}
Alarm occurrence time [hour]
Range: 0 - 23 (*1)
minute : {number}
Alarm occurrence time [minutes]
Range: 0 - 59 (*1)
second : {number}
Alarm occurrence time [second]
Range: 0 - 59 (*1)
timeout : {number}
Timeout value of the first alarm occurrence time [s]
Range: 1 - 10 (*2)
*1: Setting it to -1 means "don't care".
callback()functionmandatoryExecutes callback processing when an alarm occurs.
returnundefined--When an error occurs, an exception is raised.

*2: If there is no margin between the current time and the first alarm occurrence time, the alarm settings may not be in time due to internal delays. This option uses a timer to complement this situation. If the alarm does not occur before the timeout, executes callback processing instead of the alarm. Set this option when the margin until the alarm occurrence time is less than 10 seconds. If not set, it will be invalid.

rtc.stopAlarm()

Releases the alarm.

NameType/ObjectM/OSummaryNote
returnundefined--

rtc.getInitTimeCorrVal()

Gets the correction value after time synchronization for timestamp values acquired when the system time was not yet set.
It is also possible to determine if the system time has been set (time synchronized).
This function can be utilized when using Express Mode.

Timestamp values when the system time had not yet been set can be converted to the present time by adding this correction value after time synchronization (after the correction value becomes non-zero).

NameTypeM/OSummary                         Note
returnnumber-Timestamp Correction Value
0: System time not set
Other than 0: Correction Value [ms]
If 0, It indicates that the system time is not set.
If not 0, it indicates that time synchronization has been completed and the correct time is retained.

Use as follows:

var timestamp = Date.now();
print("Timestamp before time-sync: " + timestamp + " (" + new Date(timestamp) + ")");

while(!rtc.getInitTimeCorrVal()); //Waiting for time synchronization
var utime = Date.now();
print("Time synchronized: " + utime + " (" + new Date(utime) + ")");

var corVal = rtc.getInitTimeCorrVal();
print("Correction value: " + corVal);
timestamp += corVal;
print("Corrected timestamp: " + timestamp + " (" + new Date(timestamp) + ")");
Timestamp before time-sync: 946684812645 (Sat Jan 01 2000 00:00:12 GMT+00:00)
Time synchronized: 1654050009000 (Wed Jun 01 2022 02:20:09 GMT+00:00)
Correction value: 707365142297
Corrected timestamp: 1654049954942 (Wed Jun 01 2022 02:19:14 GMT+00:00)



Object Usage Examples

Sample1

This is a sample that generates an alarm.
Gets the current time and raises an RTC alarm 20 seconds after that time.

var MAX_COUNT = 5;
var count = MAX_COUNT;
var set_date;
var rtc_time;

var perAlarm = function() {
    rtc.stopAlarm();
    count--;
    print('alarm: count = ' + count);
    set_date = new Date();
    print('Now time: ' + set_date.toString());
    if(count > 0) {
        set_date.setSeconds(set_date.getSeconds() + 20);
        rtc_time = {    
            hour: set_date.getHours(),
            minute: set_date.getMinutes(),
            second: set_date.getSeconds()
        };
        rtc.setAlarm(rtc_time, perAlarm);
    }
}

perAlarm();



Updated: 2022-06-03
← 09. Sleep11. UserSW →
  • rtc Global Object
  • Details
    • rtc.setAlarm(rtcAlarm[,callback])
    • rtc.stopAlarm()
    • rtc.getInitTimeCorrVal()
  • Object Usage Examples
    • Sample1
AboutNewsProductsFAQPrivacy Policy}
NEQTO Console
IntroductionFundamentalsAdministrative ActionsDevice Management NEQTO Apps
NEQTO Bridge
NEQTO Bridge ModuleNEQTO Bridge Wi-Fi ModuleNEQTO Bridge LTE-1 ModuleError Logging Event Messages
API Documentation
API UsageGlobal APIRegional APIAPI Terms of Service
Jigsaw, Inc.
© 2023 JIG-SAW INC.