mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-05-10 23:00:03 +02:00
remove cest as strptime doesnt work on bfin with timezone
This commit is contained in:
parent
2d2287e189
commit
2813cd5ac2
@ -65,6 +65,22 @@ int getAbsPath(char *buf, size_t bufSize, char *fname) {
|
||||
}
|
||||
|
||||
int GetTimeFromString(char *buf, time_t *result) {
|
||||
// remove timezone as strptime cannot validate timezone despite
|
||||
// documentation
|
||||
const char *timezone = {"CEST"};
|
||||
char *res = strstr(buf, timezone);
|
||||
if (res != NULL) {
|
||||
size_t cestPos = res - buf;
|
||||
size_t pos = cestPos + strlen(timezone) + 1;
|
||||
while (pos != strlen(buf)) {
|
||||
buf[cestPos] = buf[pos];
|
||||
++cestPos;
|
||||
++pos;
|
||||
}
|
||||
buf[cestPos] = '\0';
|
||||
}
|
||||
|
||||
// convert to time structure
|
||||
struct tm t;
|
||||
if (NULL == strptime(buf, "%a %b %d %H:%M:%S %Z %Y", &t)) {
|
||||
return FAIL;
|
||||
|
Loading…
x
Reference in New Issue
Block a user