struct tm* tm = localtime(&mtime);
char mtimestr[256];
strftime(mtimestr, 255, "%a %b %d %H:%M:%S %Z %Y", tm);
- printf("Opened the database (Version %d, Modified at %s).\n", dataworks_database_get_version(db), mtimestr);
+ printf("Opened the database (Version %d, Modified at %s).\n", dataworks_database_get_version(db), mtimestr);
printf("\n");
printf("Type a command (.help) for the help.\n");
printf("\n");
const char* dw_errors[] = {"Success", "Used already"};
const char* dataworks_database_strerror(int n) { return dw_errors[n]; }
+
+void dataworks_database_update_mtime(struct dataworks_db* db) {
+ __dw_lockfile(db->fp);
+ fseek(db->fp, 3 + 2, SEEK_SET);
+ int64_t t = time(NULL);
+ __dw_big_endian(t, int64_t, fwrite(__converted_ptr, 1, 8, db->fp));
+ __dw_unlockfile(db->fp);
+}
}
free(buf);
__dw_unlockfile(db->fp);
+ dataworks_database_update_mtime(db);
}
}
*/
const char* dataworks_database_strerror(int n);
+/**
+ * @~english
+ * @brief Update mtime.
+ * @param db Database
+ *
+ */
+void dataworks_database_update_mtime(struct dataworks_db* db);
+
#ifdef __cplusplus
}
#endif