core-legacy/helpers/get_day_of_week.cc

13 lines
248 B
C++
Raw Normal View History

2020-04-23 15:00:12 +00:00
#include <netdb.h>
#include <helpers.h>
int
helpers::get_day_of_week()
{
time_t t = time(NULL);
struct tm *now = localtime(&t);
int wday_sun_sat = now->tm_wday;
int wday_mon_sun = (wday_sun_sat + 6) % 7;
return wday_mon_sun;
}