mirror of https://github.com/BOINC/boinc.git
Fixed get_timezone function to work on all platforms correctly.
svn path=/trunk/boinc/; revision=220
This commit is contained in:
parent
08b169f131
commit
cd8ce7e17a
|
@ -118,17 +118,15 @@ char* ip_addr_string(int ip_addr) {
|
||||||
return inet_ntoa(ia);
|
return inet_ntoa(ia);
|
||||||
}
|
}
|
||||||
|
|
||||||
// What does this return? # of seconds from GMT?
|
// Returns the number of seconds difference from UTC
|
||||||
//
|
//
|
||||||
void get_timezone(int& tz) {
|
int get_timezone( void ) {
|
||||||
tzset();
|
time_t cur_time;
|
||||||
|
struct tm *time_data;
|
||||||
|
|
||||||
// TODO: take daylight savings time into account
|
cur_time = time(NULL);
|
||||||
#ifdef __timezone
|
time_data = localtime( &cur_time );
|
||||||
tz = __timezone;
|
return time_data->tm_gmtoff;
|
||||||
#else
|
|
||||||
tz = timezone;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns true if the host is currently running off battery power
|
// Returns true if the host is currently running off battery power
|
||||||
|
@ -255,7 +253,7 @@ int get_host_info(HOST_INFO& host) {
|
||||||
#endif
|
#endif
|
||||||
get_local_domain_name(host.domain_name);
|
get_local_domain_name(host.domain_name);
|
||||||
get_local_ip_addr_str(host.ip_addr);
|
get_local_ip_addr_str(host.ip_addr);
|
||||||
get_timezone(host.timezone);
|
host.timezone = get_timezone();
|
||||||
#ifdef HAVE_SYS_UTSNAME_H
|
#ifdef HAVE_SYS_UTSNAME_H
|
||||||
get_osinfo(host);
|
get_osinfo(host);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue