xmidt-org / aker

Aker is an experimental MAC address blocking scheduler.
Apache License 2.0
4 stars 17 forks source link

Add time_zone support in MsgPack #100

Closed schmidtw closed 6 years ago

schmidtw commented 6 years ago

Suggested place to start:

int main (int argc, char *argv[])
{
   struct tm *mt;
   time_t mtt;
   char ftime[10];

   setenv("TZ", "America/New_York", 1);
   tzset();
   mtt = time(NULL);
   mt = localtime(&mtt);
   strftime(ftime,sizeof(ftime),"%Z %H%M",mt);

   printf("%s\n", ftime);
}
manderiasian commented 6 years ago

OK this is done. However, I am a little confused. Why do we need the time_zone? The only reason I see is if we need to know DST, and I am not even sure about that. Since "absolutes" times are given to us in UTC, if we use time() we also get UTC, so the only adjustment is possibly to apply DST ...

schmidtw commented 6 years ago

The time_zone is there for the weekly schedule portion.