]> Pileus Git - ~andy/csm213a-hw/blobdiff - hw2/main_time.h
Refactor main into separate files
[~andy/csm213a-hw] / hw2 / main_time.h
diff --git a/hw2/main_time.h b/hw2/main_time.h
new file mode 100644 (file)
index 0000000..e0d2733
--- /dev/null
@@ -0,0 +1,31 @@
+#ifndef MAIN_TIME_H
+#define MAIN_TIME_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+/* Constants */
+#define NSEC_PER_SEC 1000000000ULL
+
+/* Initialization */
+void time_init(void);
+
+/* Time conversino functions */
+uint64_t time_to_world(uint64_t local);
+uint64_t time_to_local(uint64_t world);
+
+/* External time syncronization */ 
+void time_ext_init(uint64_t local, uint64_t world);
+void time_ext_sync(uint64_t local, uint64_t world);
+
+/* Helper functions */
+void time_printf(const char *label, uint64_t local);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif