mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-02-19 19:28:40 +01:00
using common.c to extract date and using nios.c to check kernel version(a bit specific to nios) and using c api instead of system command to get uname
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
#define _GNU_SOURCE // needed for strptime to be at the top
|
||||
#include "common.h"
|
||||
#include "clogger.h"
|
||||
#include "sls_detector_defs.h"
|
||||
@@ -59,4 +60,13 @@ int getAbsPath(char *buf, size_t bufSize, char *fname) {
|
||||
sprintf(buf, "%s/%s", dir, fname);
|
||||
LOG(logDEBUG1, ("full path for %s: %s\n", fname, buf));
|
||||
return OK;
|
||||
}
|
||||
|
||||
int GetTimeFromString(char *buf, time_t *result) {
|
||||
struct tm t;
|
||||
if (NULL == strptime(buf, "%a %b %d %H:%M:%S %Z %Y", &t)) {
|
||||
return FAIL;
|
||||
}
|
||||
*result = mktime(&t);
|
||||
return OK;
|
||||
}
|
||||
Reference in New Issue
Block a user