/* Builds an ascii string for the passed in time */ void getAsciiTime( char *psText, UDWORD time ) { UDWORD hours,minutes,seconds; getTimeComponents(time,&hours,&minutes,&seconds); constructTime(psText,hours,minutes,seconds); }
bool constructTime(time_t &time, struct tm &result, int year, int month, int day, int hour, int minute, int second) { time_t now = mytime(NULL); struct tm ltime; localtime_r(&now,<ime); return constructTime(time, result, year, month, day, hour, minute, second, ltime.tm_isdst); }
bool getNoon(time_t &time, struct tm &result, int year, int month, int day) { return constructTime(time, result, year, month, day, 12, 0, 0, -1); }
/* getNoon() * Shorthand time construct to retrieve the ctime value and corresponding tm struct for noon. * Accepts date components for specifying another date than today. * * While noon has no special meaning in Domoticz, you may use this function to save CPU cycles * if you are only interested in the (corrected) date. */ bool getNoon(time_t &time, struct tm &result) { time_t now = mytime(NULL); struct tm ltime; localtime_r(&now,<ime); return constructTime(time, result, ltime.tm_year+1900, ltime.tm_mon+1, ltime.tm_mday, 12, 0, 0, ltime.tm_isdst); }
bool getMidnight(time_t &time, struct tm &result, int year, int month, int day) { return constructTime(time, result, year, month, day, 0, 0, 0); }