Changes for the journal protocol
This commit is contained in:
parent
da23d4c54a
commit
817eb0231c
3 changed files with 18 additions and 1 deletions
|
@ -6,7 +6,7 @@
|
||||||
* Interface to data storage
|
* Interface to data storage
|
||||||
*/
|
*/
|
||||||
|
|
||||||
enum DatastoreCursorOp { CURSOR_FIRST, CURSOR_NEXT };
|
enum DatastoreCursorOp { CURSOR_FIRST, CURSOR_NEXT, CURSOR_LAST, CURSOR_PREVIOUS };
|
||||||
|
|
||||||
struct Datastore {
|
struct Datastore {
|
||||||
char* type;
|
char* type;
|
||||||
|
|
|
@ -77,4 +77,10 @@ int os_utils_directory_exists(const char* path);
|
||||||
*/
|
*/
|
||||||
int os_utils_is_directory(const char* file_name);
|
int os_utils_is_directory(const char* file_name);
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Get the current time in GMT (UTC) as seconds since epoch
|
||||||
|
* @returns seconds since epoch
|
||||||
|
*/
|
||||||
|
unsigned long long os_utils_gmtime();
|
||||||
|
|
||||||
#endif /* utils_h */
|
#endif /* utils_h */
|
||||||
|
|
11
os/utils.c
11
os/utils.c
|
@ -10,6 +10,7 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get an environment varible from the os
|
* get an environment varible from the os
|
||||||
|
@ -180,3 +181,13 @@ int os_utils_file_size(const char* path) {
|
||||||
fclose(in_file);
|
fclose(in_file);
|
||||||
return file_size;
|
return file_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Get the current time in GMT (UTC) as seconds since epoch
|
||||||
|
* @returns seconds since epoch
|
||||||
|
*/
|
||||||
|
unsigned long long os_utils_gmtime() {
|
||||||
|
time_t local = time(NULL);
|
||||||
|
struct tm *gmt = gmtime(&local);
|
||||||
|
return (unsigned long long)mktime(gmt);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue