NetBurner 3.5.6
PDF Version
HtmlPostDateTime

HTML Date Time Post Application

Overview

The HTML Date Time Post Application is a web-based embedded system application that demonstrates how to handle date and time operations through a web interface. Built using the NetBurner NNDK (NetBurner Network Development Kit), this application provides a complete example of:

  • Web server functionality with HTTP POST handling
  • Date/time configuration management through web forms
  • Time synchronization via NTP (Network Time Protocol)
  • Time zone handling and display formatting
  • Configuration persistence across system restarts

Config System Date and Time variables are used to post and display date and time from the config system to/from an HTML form. This uses the config form post helper functions.

Features

Core Functionality

  • Web Server: Built-in HTTP server running on port 80
  • Date/Time Forms: HTML forms for setting and displaying date/time values
  • NTP Synchronization: Automatic time synchronization from NTP pool servers
  • Time Zone Support: Configurable for PST/PDT with daylight saving transitions
  • Configuration Persistence: Saves time settings to non-volatile storage
  • Time Calculations: Shows time intervals and differences

Web Interface Components

  • Date Input Form (dateform): Manual date/time entry
  • Auto Date Form (autodateform): Automated configuration handling
  • Time Display: Shows stored time in both local and UTC formats
  • Time Delta: Displays time difference from current time

Technical Architecture

Key Components

  1. Configuration Management
    • config_time_t StoredTimeObj: Manages persistent time storage
    • Default time: "2022-05-14T17:05:00"
    • Automatic saving to configuration storage
  2. HTTP POST Handling
    • DateformPostCallBack(): Processes manual date form submissions
    • HtmlPostVariableListCallback: Handles form variables
    • HtmlPostConfigVariableHandler: Manages configuration forms
  3. Display Functions
    • FillInDateValue(): Outputs stored time in local format
    • FillInDateValueUtc(): Outputs stored time in UTC format
    • ShowDeltaTime(): Calculates and displays time differences
    • ShowTimeInterval(): Formats time intervals (days, hours, minutes, seconds)
  4. Network & Time Services
    • DHCP network configuration
    • NTP time synchronization with retry logic
    • Time zone configuration for PST/PDT

System Requirements

  • NetBurner NNDK development environment
  • Network connectivity for DHCP and NTP
  • Web browser for interface access

Configuration

Time Zone Setting

The application is configured for Pacific Time Zone:

tzsetchar("PST8PDT7,M3.2.0/02:00:00,M11.1.0/02:00:00");
void tzsetchar(const char *tzenv)
Set the system local time.
  • PST: Pacific Standard Time (UTC-8)
  • PDT: Pacific Daylight Time (UTC-7)
  • Automatic DST transitions in March and November

Default Values

  • Application Name: "HTML Date Time Post Example"
  • Default Time: 2022-05-14T17:05:00
  • Network Timeout: 5 seconds for DHCP
  • NTP Retry Interval: 5 seconds

Usage

  1. System Startup
    • Device initializes network stack
    • Attempts DHCP network configuration
    • Starts HTTP server on port 80
    • Synchronizes time via NTP
  2. Web Access
    • Navigate to device IP address in web browser
    • Use HTML forms to set date/time values
    • View current stored time and time differences
  3. Form Submission
    • Submit new date/time through dateform
    • Values are parsed and stored persistently
    • Browser redirects to index.html after submission

Development Notes

Key Files Expected

  • index.html: Main web interface page
  • Configuration storage for persistent settings
  • Network configuration for DHCP/static IP

Debugging Features

  • System diagnostics enabled (should be disabled for production)
  • Console output for time synchronization status
  • Application and NNDK revision information display

Error Handling

  • Graceful handling of NTP synchronization failures
  • Retry mechanism for time setting
  • Validation of submitted date/time values

Build Requirements

This application requires the NetBurner NNDK with the following modules:

  • Network stack initialization
  • HTTP POST processing
  • Configuration system
  • NTP client functionality
  • Time zone management

For production deployment, consider disabling system diagnostics and implementing additional security measures for web access.

API Reference

Main Functions

  • UserMain(): Application entry point and main loop
  • DateformPostCallBack(): Handles POST form submissions
  • ShowTimeInterval(): Formats time duration display
  • FillInDateValue() / FillInDateValueUtc(): Provide time values for web display

Configuration Objects

  • StoredTimeObj: Persistent time storage with automatic loading/saving
  • Time format: ISO 8601 compatible string parsing and generation