0068611b4d
Now we manage a timezone and daylight-savings aware version of localtime. We parse UNIX timezone strings. The default (active after the first call to localtime or localtime_r) is CET/CEST, the timezone of Europe/Vienna. The wallclock-time osd-example demonstrates how to set a different timezone via the timezone resource. Note: After startup no timezone is set. So in this state querying the timezone resource will return an empty string. After first call to localtime (if not timezone has been set via the timezone resource) a query to timezone will return the default timezone string for CET/CEST. The string returned by the localtime and utc timezones now also includes the timezone name. New fields tm_gmtoff and tm_zone were added to the tm structure. These are available in BSD systems and when setting special compiler definitions on Linux. Note: the timezone offset information in the tm structure (tm_gmtoff) as well as in the tz structure returned by gettimeofday (tz_minuteswest) may be wrong sign, this code is largely untested.
28 lines
495 B
C
28 lines
495 B
C
/**
|
|
* \addgroup Time related functions
|
|
*
|
|
* Resource definitions for time module
|
|
*
|
|
* @{
|
|
*/
|
|
|
|
/**
|
|
* \file
|
|
* Resource definitions for the time module
|
|
*
|
|
* \author
|
|
* Ralf Schlatterbeck <rsc@tux.runtux.com>
|
|
*/
|
|
|
|
#ifndef time_resource_h
|
|
#define time_resource_h
|
|
#include "contiki.h"
|
|
#include "rest-engine.h"
|
|
|
|
extern resource_t res_timestamp;
|
|
extern resource_t res_timezone;
|
|
extern resource_t res_localtime;
|
|
extern resource_t res_utc;
|
|
|
|
#endif // time_resource_h
|
|
/** @} */
|