Solved `daylight` in FreeBSD C library

Hi!

I'm porting some Linux C++ application to FreeBSD, but ran into the next error:
'daylight is not declared in this scope'.
In glibc `int daylight` is declared in time.h and defines if the summertime is enabled.
So the question is: does the daylight alternative exists in FreeBSD C library or I should implement it by myself in the code?
 
All POSIX-compliant systems should have tm_isdst field within the tm structure to determine if daylight saving time is in effect.

C++:
#include <iostream>
#include <ctime>

int main() {
    std::time_t timer;
    std::time(&timer);
    std::tm* tm_info;
    tm_info = std::localtime(&timer);
    if (tm_info->tm_isdst > 0) {
        std::cout << "Daylight Saving Time is active." << std::endl;
    } else {
        std::cout << "Daylight Saving Time is not active." << std::endl;
    }
    return 0;
}
fr0xk@eula47 ~ : g++ -Wall -Wextra -Werror -o tm_isdst tm_isdst.cpp
fr0xk@eula47 ~ : ./tm_isdst
Daylight Saving Time is not active.
 
Back
Top