mirror of
https://github.com/lifegpc/c-utils.git
synced 2026-07-08 01:30:39 +08:00
Fix bug
This commit is contained in:
14
meson.build
14
meson.build
@@ -49,8 +49,8 @@ endif
|
|||||||
|
|
||||||
|
|
||||||
if MSVC
|
if MSVC
|
||||||
add_project_arguments('/UTF8', language: 'c')
|
add_project_arguments('/utf-8', language: 'c')
|
||||||
add_project_arguments('/UTF8', language: 'cpp')
|
add_project_arguments('/utf-8', language: 'cpp')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if WIN32
|
if WIN32
|
||||||
@@ -95,6 +95,16 @@ if conf.get('HAVE_STRERROR_R') == 1
|
|||||||
conf.set10('HAVE_GNU_STRERROR_R', HAVE_GNU_STRERROR_R)
|
conf.set10('HAVE_GNU_STRERROR_R', HAVE_GNU_STRERROR_R)
|
||||||
message('strerror_r is GNU complatable:', HAVE_GNU_STRERROR_R)
|
message('strerror_r is GNU complatable:', HAVE_GNU_STRERROR_R)
|
||||||
endif
|
endif
|
||||||
|
if not MSVC
|
||||||
|
conf.set10('HAVE_TIMEZONE', cc.has_header_symbol('time.h', 'timezone'))
|
||||||
|
conf.set10('HAVE_TZSET', cc.has_header_symbol('time.h', 'tzset'))
|
||||||
|
endif
|
||||||
|
if not WIN32
|
||||||
|
conf.set10('HAVE_CLOCK_GETTIME', cc.has_header_symbol('time.h', 'clock_gettime'))
|
||||||
|
conf.set10('HAVE_USLEEP', cc.has_header_symbol('unistd.h', 'usleep'))
|
||||||
|
conf.set10('HAVE_NANOSLEEP', cc.has_header_symbol('time.h', 'nanosleep'))
|
||||||
|
conf.set10('HAVE_NETINET_IN_H', cc.check_header('netinet/in.h'))
|
||||||
|
endif
|
||||||
configure_file(output: 'utils_config.h', configuration: conf)
|
configure_file(output: 'utils_config.h', configuration: conf)
|
||||||
|
|
||||||
source_file = files([
|
source_file = files([
|
||||||
|
|||||||
@@ -35,7 +35,10 @@ char* time_util::strptime(const char* s, const char* format, struct tm* tm) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
long time_util::get_timezone() {
|
long time_util::get_timezone() {
|
||||||
#if HAVE__GET_TIMEZONE
|
#if HAVE_TIMEZONE && HAVE_TZSET
|
||||||
|
tzset();
|
||||||
|
return timezone;
|
||||||
|
#elif HAVE__GET_TIMEZONE
|
||||||
long t = 0;
|
long t = 0;
|
||||||
int err = _get_timezone(&t);
|
int err = _get_timezone(&t);
|
||||||
if (!err) {
|
if (!err) {
|
||||||
@@ -48,9 +51,6 @@ long time_util::get_timezone() {
|
|||||||
} else {
|
} else {
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
#elif HAVE_TIMEZONE && HAVE_TZSET
|
|
||||||
tzset();
|
|
||||||
return timezone;
|
|
||||||
#else
|
#else
|
||||||
printf("get_timezone failed: not implemented\n");
|
printf("get_timezone failed: not implemented\n");
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user