From 54dd06b14946f14027d723a3a990f5402a2cf511 Mon Sep 17 00:00:00 2001
From: massung1 <massung1@6fbd10e7-183d-0410-a318-cb416676e4f2>
Date: Wed, 5 Sep 2012 20:47:16 +0000
Subject: [PATCH] added time output for monad runs

git-svn-id: https://subversion.cs.illinois.edu/svn/cs225@7682 6fbd10e7-183d-0410-a318-cb416676e4f2
---
 source/monad.cpp | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/source/monad.cpp b/source/monad.cpp
index 8919371..59486ec 100644
--- a/source/monad.cpp
+++ b/source/monad.cpp
@@ -62,6 +62,16 @@ bool optimize = false;
 
 }
 
+// http://stackoverflow.com/questions/997946/c-get-current-time-and-date
+string getTime()
+{
+    time_t now = time(0);
+    struct tm tstruct;
+    char buf[80];
+    tstruct = *localtime(&now);
+    strftime(buf, sizeof(buf), "%Y-%m-%d %X", &tstruct);
+    return buf;
+}
 
 int main(int argc, const char * const * argv)
 {
@@ -78,10 +88,9 @@ int main(int argc, const char * const * argv)
 	processArgs(argc, argv);
 
 	cout << versioninfo::official_name << endl;
-	cout << "Testing " << assignment_base;
+	cout << "Testing " << assignment_base << " at " << getTime() << endl;
 	if (mp_part != no_mp_part) cout << '.' << (int)mp_part;
-	cout << "..." << endl;
-	cout << getRandomQuote() << endl;
+	cout << endl << getRandomQuote() << endl;
 	cout << endl;
 
 	cout << "Setting up test environment..." << endl;
-- 
GitLab