forked from HowardHinnant/date
An attempt to tidy up current_timezone()
This commit is contained in:
9
tz.cpp
9
tz.cpp
@@ -1670,10 +1670,11 @@ current_timezone()
|
|||||||
if (sz <= tmp)
|
if (sz <= tmp)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (result.compare(0, 20, "/usr/share/zoneinfo/")==0)
|
const char zonepath[] = "/usr/share/zoneinfo/";
|
||||||
result.erase(0, 20);
|
const size_t zonepath_len = sizeof(zonepath)/sizeof(zonepath[0])-1;
|
||||||
else if (result.compare(0, 22, "../usr/share/zoneinfo/")==0)
|
const size_t pos = result.find(zonepath);
|
||||||
result.erase(0, 22);
|
if (pos != result.npos)
|
||||||
|
result.erase(0, zonepath_len+pos);
|
||||||
return locate_zone(result);
|
return locate_zone(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user