Squashed 'third_party/allwpilib_2016/' content from commit 7f61816

Change-Id: If9d9245880859cdf580f5d7f77045135d0521ce7
git-subtree-dir: third_party/allwpilib_2016
git-subtree-split: 7f618166ed253a24629934fcf89c3decb0528a3b
diff --git a/hal/lib/Athena/Utilities.cpp b/hal/lib/Athena/Utilities.cpp
new file mode 100644
index 0000000..b34677f
--- /dev/null
+++ b/hal/lib/Athena/Utilities.cpp
@@ -0,0 +1,44 @@
+#include "HAL/Utilities.hpp"
+#include <time.h>
+
+const int32_t HAL_NO_WAIT = 0;
+const int32_t HAL_WAIT_FOREVER = -1;
+
+void delayTicks(int32_t ticks)
+{
+	struct timespec test, remaining;
+	test.tv_sec = 0;
+	test.tv_nsec = ticks * 3;
+
+	/* Sleep until the requested number of ticks has passed, with additional
+		time added if nanosleep is interrupted. */
+	while(nanosleep(&test, &remaining) == -1) {
+		test = remaining;
+	}
+}
+
+void delayMillis(double ms)
+{
+	struct timespec test, remaining;
+	test.tv_sec = ms / 1000;
+	test.tv_nsec = 1000 * (((uint64_t)ms) % 1000000);
+
+	/* Sleep until the requested number of milliseconds has passed, with
+		additional time added if nanosleep is interrupted. */
+	while(nanosleep(&test, &remaining) == -1) {
+		test = remaining;
+	}
+}
+
+void delaySeconds(double s)
+{
+	struct timespec test, remaining;
+	test.tv_sec = (int)s;
+	test.tv_nsec = (s - (int)s) * 1000000000.0;
+
+	/* Sleep until the requested number of seconds has passed, with additional
+		time added if nanosleep is interrupted. */
+	while(nanosleep(&test, &remaining) == -1) {
+		test = remaining;
+	}
+}