core-legacy/helpers/get_day_of_week.cc

12 lines
248 B
C++

#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;
}