Some fixes to minuteChanged, ezt:: namespace, documentation fixes

pull/8/head 0.7.5
Rop 7 years ago
parent 417aed0119
commit 7603095917

@ -378,9 +378,9 @@ In the case of `SERVER_ERROR`, `errorString()` returns the error from the server
 
### Timezone caching, timezoneapi.io, EEPROM or NVS
### Timezone caching, EEPROM or NVS
If you use setLocation, the timezone information comes from timezoneapi.io, a service on the Internet that provides this information. They give everyone 50 free requests per day, so if your Arduino would get stuck in a loop where it boots all the time you would eventually not get timezone information anymore. Also, if that service goes away, your Arduino would not know what time it is anymore.
If you use setLocation, the timezone information comes from timezoned.rop.nl. I'll try to keep that running as stable as possible, but if that service has a problem, your Arduino would not know what time it is anymore.
That is why you can create a place for ezTime to store the data about the timezone. That way, it doens't need to get the information anew every time the Arduino boots. You can store the cache for a timezone in EEPROM (the default) or NVS.
@ -422,7 +422,7 @@ The Chatham Islands are in Pacific about 800 kilometres east of New Zealand. Som
#### Morocco
Morocco goes on and off Daylight Saving Time twice per year. This currently breaks ezTime as timezoneapi.io gives us a posix string that only contains the first of the periods. Fortunately they will stop doing this in 2020: the Moroccans probably got tired of all the clocks that did not adjust properly.
Morocco goes on and off Daylight Saving Time twice per year. This currently breaks ezTime as our parser can only handle one DST period per year. Fortunately they will stop doing this in 2020: the Moroccans probably got tired of all the clocks that did not adjust properly.
 
@ -535,7 +535,7 @@ These will tell if it is before or after noon for a given `TIME`, return `true`
 
`uint16_t dayOfYear(TIME)`    — Both assume default timezone if no timezone is prefixed
`uint16_t dayOfYear(TIME)`    — Assumes default timezone if no timezone is prefixed
Returns how many days have passed in the year. January 1st returns 0,
@ -835,7 +835,7 @@ Global variables use 733 bytes (35%) of dynamic memory, leaving 1315 bytes for l
By setting `#define EZTIME_MAX_DEBUGLEVEL_NONE` in `eztime.h` we can free up some more flash:
```
ketch uses 23870 bytes (74%) of program storage space. Maximum is 32256 bytes.
Sketch uses 23870 bytes (74%) of program storage space. Maximum is 32256 bytes.
Global variables use 729 bytes (35%) of dynamic memory, leaving 1319 bytes for local variables. Maximum is 2048 bytes.
```
@ -936,7 +936,7 @@ ezTime 0.7.2 runs fine (No networking on board, so tested with NoNetwork example
* [getTimezoneName](#gettimezonename)
* [getOffset](#getoffset)
* [setLocation](#setlocation)
* [Timezone caching, timezoneapi.io, EEPROM or NVS](#timezone-caching-timezoneapiio-eeprom-or-nvs)
* [Timezone caching, EEPROM or NVS](#timezone-caching-eeprom-or-nvs)
* [setCache](#setcache)
* [clearCache](#clearcache)
* [Crazy timezones](#crazy-timezones)

@ -11,7 +11,7 @@
"type": "git",
"url": "https://github.com/ropg/ezTime"
},
"version": "0.7.4",
"version": "0.7.5",
"framework": "arduino",
"platforms": "*",
"build": {

@ -1,5 +1,5 @@
name=ezTime
version=0.7.4
version=0.7.5
author=Rop Gonggrijp
maintainer=Rop Gonggrijp
sentence=ezTime - pronounced "Easy Time" - is a very easy to use Arduino time and date library that provides NTP network time lookups, extensive timezone support, formatted time and date strings, user events, millisecond precision and more.

File diff suppressed because it is too large Load Diff

@ -165,34 +165,37 @@ typedef struct {
#define ISO8601_YWD "X-\\WW-N"
#define DEFAULT_TIMEFORMAT COOKIE
void breakTime(const time_t time, tmElements_t &tm);
time_t compileTime(const String compile_date = __DATE__, const String compile_time = __TIME__);
String dayString(const uint8_t day);
void deleteEvent(const uint8_t event_handle);
void deleteEvent(void (*function)());
ezError_t error(const bool reset = false);
String errorString(const ezError_t err = LAST_ERROR);
void events();
time_t makeOrdinalTime(const uint8_t hour, const uint8_t minute, const uint8_t second, uint8_t ordinal, const uint8_t wday, const uint8_t month, uint16_t year);
time_t makeTime(tmElements_t &tm);
time_t makeTime(const uint8_t hour, const uint8_t minute, const uint8_t second, const uint8_t day, const uint8_t month, const uint16_t year);
bool minuteChanged();
String monthString(const uint8_t month);
bool secondChanged();
void setDebug(const ezDebugLevel_t level);
void setDebug(const ezDebugLevel_t level, Print &device);
timeStatus_t timeStatus();
String urlEncode(const String str);
String zeropad(const uint32_t number, const uint8_t length);
#ifdef EZTIME_NETWORK_ENABLE
bool queryNTP(const String server, time_t &t, unsigned long &measured_at);
void setInterval(const uint16_t seconds = 0);
void setServer(const String ntp_server = NTP_SERVER);
void updateNTP();
bool waitForSync(const uint16_t timeout = 0);
#endif
namespace ezt {
void breakTime(const time_t time, tmElements_t &tm);
time_t compileTime(const String compile_date = __DATE__, const String compile_time = __TIME__);
String dayShortStr(const uint8_t month);
String dayStr(const uint8_t month);
void deleteEvent(const uint8_t event_handle);
void deleteEvent(void (*function)());
ezError_t error(const bool reset = false);
String errorString(const ezError_t err = LAST_ERROR);
void events();
time_t makeOrdinalTime(const uint8_t hour, const uint8_t minute, const uint8_t second, uint8_t ordinal, const uint8_t wday, const uint8_t month, uint16_t year);
time_t makeTime(const uint8_t hour, const uint8_t minute, const uint8_t second, const uint8_t day, const uint8_t month, const uint16_t year);
time_t makeTime(tmElements_t &tm);
bool minuteChanged();
String monthShortStr(const uint8_t month);
String monthStr(const uint8_t month);
bool secondChanged();
void setDebug(const ezDebugLevel_t level);
void setDebug(const ezDebugLevel_t level, Print &device);
timeStatus_t timeStatus();
String urlEncode(const String str);
String zeropad(const uint32_t number, const uint8_t length);
#ifdef EZTIME_NETWORK_ENABLE
bool queryNTP(const String server, time_t &t, unsigned long &measured_at);
void setInterval(const uint16_t seconds = 0);
void setServer(const String ntp_server = NTP_SERVER);
void updateNTP();
bool waitForSync(const uint16_t timeout = 0);
#endif
}
//
// T i m e z o n e c l a s s
@ -269,34 +272,39 @@ class Timezone {
extern Timezone UTC;
extern Timezone *defaultTZ;
// These bounce through to same-named methods in defaultTZ
String dateTime(const String format = DEFAULT_TIMEFORMAT);
String dateTime(time_t t, const String format = DEFAULT_TIMEFORMAT);
String dateTime(time_t t, const ezLocalOrUTC_t local_or_utc, const String format = DEFAULT_TIMEFORMAT);
uint8_t day(time_t t = TIME_NOW, const ezLocalOrUTC_t local_or_utc = LOCAL_TIME);
uint16_t dayOfYear(time_t t = TIME_NOW, const ezLocalOrUTC_t local_or_utc = LOCAL_TIME);
int16_t getOffset(time_t t = TIME_NOW, const ezLocalOrUTC_t local_or_utc = LOCAL_TIME);
String getTimezoneName(time_t t = TIME_NOW, const ezLocalOrUTC_t local_or_utc = LOCAL_TIME);
uint8_t hour(time_t t = TIME_NOW, const ezLocalOrUTC_t local_or_utc = LOCAL_TIME);
uint8_t hourFormat12(time_t t = TIME_NOW, const ezLocalOrUTC_t local_or_utc = LOCAL_TIME);
bool isAM(time_t t = TIME_NOW, const ezLocalOrUTC_t local_or_utc = LOCAL_TIME);
bool isDST(time_t t = TIME_NOW, const ezLocalOrUTC_t local_or_utc = LOCAL_TIME);
bool isPM(time_t t = TIME_NOW, const ezLocalOrUTC_t local_or_utc = LOCAL_TIME);
String militaryTZ(time_t t = TIME_NOW, const ezLocalOrUTC_t local_or_utc = LOCAL_TIME);
uint8_t minute(time_t t = TIME_NOW, const ezLocalOrUTC_t local_or_utc = LOCAL_TIME);
uint8_t month(time_t t = TIME_NOW, const ezLocalOrUTC_t local_or_utc = LOCAL_TIME);
uint16_t ms(time_t t = TIME_NOW);
time_t now();
uint8_t second(time_t t = TIME_NOW, const ezLocalOrUTC_t local_or_utc = LOCAL_TIME);
uint8_t setEvent(void (*function)(), const uint8_t hr, const uint8_t min, const uint8_t sec, const uint8_t day, const uint8_t mnth, uint16_t yr);
uint8_t setEvent(void (*function)(), time_t t = TIME_NOW, const ezLocalOrUTC_t local_or_utc = LOCAL_TIME);
void setTime(const uint8_t hr, const uint8_t min, const uint8_t sec, const uint8_t day, const uint8_t month, const uint16_t yr);
void setTime(time_t t);
uint8_t weekISO(time_t t = TIME_NOW, const ezLocalOrUTC_t local_or_utc = LOCAL_TIME);
uint8_t weekday(time_t t = TIME_NOW, const ezLocalOrUTC_t local_or_utc = LOCAL_TIME);
uint16_t year(time_t t = TIME_NOW, const ezLocalOrUTC_t local_or_utc = LOCAL_TIME);
uint16_t yearISO(time_t t = TIME_NOW, const ezLocalOrUTC_t local_or_utc = LOCAL_TIME);
namespace ezt {
// These bounce through to same-named methods in defaultTZ
String dateTime(const String format = DEFAULT_TIMEFORMAT);
String dateTime(time_t t, const String format = DEFAULT_TIMEFORMAT);
String dateTime(time_t t, const ezLocalOrUTC_t local_or_utc, const String format = DEFAULT_TIMEFORMAT);
uint8_t day(time_t t = TIME_NOW, const ezLocalOrUTC_t local_or_utc = LOCAL_TIME);
uint16_t dayOfYear(time_t t = TIME_NOW, const ezLocalOrUTC_t local_or_utc = LOCAL_TIME);
int16_t getOffset(time_t t = TIME_NOW, const ezLocalOrUTC_t local_or_utc = LOCAL_TIME);
String getTimezoneName(time_t t = TIME_NOW, const ezLocalOrUTC_t local_or_utc = LOCAL_TIME);
uint8_t hour(time_t t = TIME_NOW, const ezLocalOrUTC_t local_or_utc = LOCAL_TIME);
uint8_t hourFormat12(time_t t = TIME_NOW, const ezLocalOrUTC_t local_or_utc = LOCAL_TIME);
bool isAM(time_t t = TIME_NOW, const ezLocalOrUTC_t local_or_utc = LOCAL_TIME);
bool isDST(time_t t = TIME_NOW, const ezLocalOrUTC_t local_or_utc = LOCAL_TIME);
bool isPM(time_t t = TIME_NOW, const ezLocalOrUTC_t local_or_utc = LOCAL_TIME);
String militaryTZ(time_t t = TIME_NOW, const ezLocalOrUTC_t local_or_utc = LOCAL_TIME);
uint8_t minute(time_t t = TIME_NOW, const ezLocalOrUTC_t local_or_utc = LOCAL_TIME);
uint8_t month(time_t t = TIME_NOW, const ezLocalOrUTC_t local_or_utc = LOCAL_TIME);
uint16_t ms(time_t t = TIME_NOW);
time_t now();
uint8_t second(time_t t = TIME_NOW, const ezLocalOrUTC_t local_or_utc = LOCAL_TIME);
uint8_t setEvent(void (*function)(), const uint8_t hr, const uint8_t min, const uint8_t sec, const uint8_t day, const uint8_t mnth, uint16_t yr);
uint8_t setEvent(void (*function)(), time_t t = TIME_NOW, const ezLocalOrUTC_t local_or_utc = LOCAL_TIME);
void setTime(const uint8_t hr, const uint8_t min, const uint8_t sec, const uint8_t day, const uint8_t month, const uint16_t yr);
void setTime(time_t t);
uint8_t weekISO(time_t t = TIME_NOW, const ezLocalOrUTC_t local_or_utc = LOCAL_TIME);
uint8_t weekday(time_t t = TIME_NOW, const ezLocalOrUTC_t local_or_utc = LOCAL_TIME);
uint16_t year(time_t t = TIME_NOW, const ezLocalOrUTC_t local_or_utc = LOCAL_TIME);
uint16_t yearISO(time_t t = TIME_NOW, const ezLocalOrUTC_t local_or_utc = LOCAL_TIME);
}
#ifndef EZTIME_EZT_NAMESPACE
using namespace ezt;
#endif
// The following defines all copied from the original Time lib to keep existing code working
@ -331,12 +339,6 @@ uint16_t yearISO(time_t t = TIME_NOW, const ezLocalOrUTC_t local_or_utc = LOCAL_
#define daysToTime_t ((D)) ( (D) * SECS_PER_DAY) // fixed on Jul 22 2011
#define weeksToTime_t ((W)) ( (W) * SECS_PER_WEEK)
// Aliases to match original Time library
String monthStr(const uint8_t month);
String monthShortStr(const uint8_t month);
String dayStr(const uint8_t month);
String dayShortStr(const uint8_t month);
} // extern "C++"
#endif // __cplusplus

Loading…
Cancel
Save