Added Cyc_file_last_modified_time

This commit is contained in:
Justin Ethier 2020-01-03 13:35:38 -05:00
parent d72c54ca17
commit 3e9da5e291
2 changed files with 9 additions and 0 deletions

View file

@ -529,6 +529,7 @@ void Cyc_halt(object obj);
object __halt(object obj);
object Cyc_io_delete_file(void *data, object filename);
object Cyc_io_file_exists(void *data, object filename);
time_t Cyc_file_last_modified_time(char *path);
/**@}*/
/**

View file

@ -17,6 +17,7 @@
#include <limits.h>
#include <ctype.h>
//#include <signal.h> // only used for debugging!
#include <sys/stat.h>
static uint32_t Cyc_utf8_decode(uint32_t* state, uint32_t* codep, uint32_t byte);
static int Cyc_utf8_count_code_points_and_bytes(uint8_t* s, char_type *codepoint, int *cpts, int *bytes);
@ -4321,6 +4322,13 @@ object Cyc_io_file_exists(void *data, object filename)
return boolean_f;
}
time_t Cyc_file_last_modified_time(char *path) {
struct stat attr;
stat(path, &attr);
return(attr.st_mtime);
}
// Functions internal to the runtime that use malloc
list malloc_make_pair(object a, object d)
{