示例#1
0
/* 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);
}
示例#2
0
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,&ltime);
	return constructTime(time, result, year, month, day, hour, minute, second, ltime.tm_isdst);
}
示例#3
0
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);
}
示例#4
0
/* 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,&ltime);
	return constructTime(time, result, ltime.tm_year+1900, ltime.tm_mon+1, ltime.tm_mday, 12, 0, 0, ltime.tm_isdst);
}
示例#5
0
bool getMidnight(time_t &time, struct tm &result, int year, int month, int day) {
	return constructTime(time, result, year, month, day, 0, 0, 0);
}