|
#include "doy.h"
|
|
|
|
unsigned int mrbesen::doy::getDOY(bool timezone, time_t ttime) {
|
|
if(ttime == 0) {
|
|
ttime = time(nullptr);
|
|
}
|
|
|
|
struct tm* timestruct = timezone ? localtime(&ttime) : gmtime(&ttime);
|
|
|
|
if(timestruct) {
|
|
return timestruct->tm_yday +1;
|
|
}
|
|
|
|
return 0;
|
|
} |