Changes for the journal protocol

This commit is contained in:
jmjatlanta 2017-08-24 13:30:04 -05:00
parent da23d4c54a
commit 817eb0231c
3 changed files with 18 additions and 1 deletions

View file

@ -6,7 +6,7 @@
* Interface to data storage
*/
enum DatastoreCursorOp { CURSOR_FIRST, CURSOR_NEXT };
enum DatastoreCursorOp { CURSOR_FIRST, CURSOR_NEXT, CURSOR_LAST, CURSOR_PREVIOUS };
struct Datastore {
char* type;

View file

@ -77,4 +77,10 @@ int os_utils_directory_exists(const char* path);
*/
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 */

View file

@ -10,6 +10,7 @@
#include <unistd.h>
#include <stdio.h>
#include <dirent.h>
#include <time.h>
/**
* get an environment varible from the os
@ -180,3 +181,13 @@ int os_utils_file_size(const char* path) {
fclose(in_file);
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);
}