diff --git a/Makefile.am b/Makefile.am
index 806f23a9..48eae25b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -31,6 +31,7 @@ UTIL_INCLUDE = \
stream.hpp \
string.hpp \
si.hpp \
+ time.hpp \
types.hpp \
vector.hpp \
version.hpp
@@ -56,6 +57,7 @@ UTIL_FILES = \
stream.cpp \
string.cpp \
si.cpp \
+ time.cpp \
types.cpp \
vector.cpp \
version.cpp
diff --git a/time.cpp b/time.cpp
new file mode 100644
index 00000000..d54da777
--- /dev/null
+++ b/time.cpp
@@ -0,0 +1,33 @@
+/*
+ * This file is part of libgim.
+ *
+ * libgim is free software: you can redistribute it and/or modify it under the
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later
+ * version.
+ *
+ * libgim is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with libgim. If not, see .
+ *
+ * Copyright 2010 Danny Robson
+ */
+
+#include "time.hpp"
+
+#include
+
+using namespace util;
+
+
+uint64_t
+util::nanoseconds (void) {
+ struct timespec t;
+ clock_gettime (CLOCK_REALTIME, &t);
+
+ return t.tv_sec * 1000000000 + t.tv_nsec;
+}
diff --git a/time.hpp b/time.hpp
new file mode 100644
index 00000000..ff9716b6
--- /dev/null
+++ b/time.hpp
@@ -0,0 +1,29 @@
+/*
+ * This file is part of libgim.
+ *
+ * libgim is free software: you can redistribute it and/or modify it under the
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later
+ * version.
+ *
+ * libgim is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with libgim. If not, see .
+ *
+ * Copyright 2010 Danny Robson
+ */
+
+#ifndef __UTIL_TIME_HPP
+#define __UTIL_TIME_HPP
+
+#include
+
+namespace util {
+ uint64_t nanoseconds (void);
+}
+
+#endif // __UTIL_TIME_HPP