summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--timecommand.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/timecommand.cpp b/timecommand.cpp
new file mode 100644
index 0000000..a3c2a08
--- /dev/null
+++ b/timecommand.cpp
@@ -0,0 +1,28 @@
+// Include the things we need for standard input/output and strings
+#include <iostream>
+#include <string>
+#include <ctime>
+
+// Allow main() to use arguments
+// (only required if using arguments, i.e. if
+// your script cares about the user's nick)
+int main() {
+
+ // Do something with the input string.
+ // This could be very complex or extremely simple like below.
+ // This is probably going to be the bulk of your program.
+ // This example just uses it along with user's nick to build a friendly
+ // response.
+
+ time_t t = time(0); // get time now
+ struct tm * now = localtime( & t );
+
+ std::cout << "The current time is: " << (now->tm_hour) << ':'
+
+ << (now->tm_min) << ':'
+
+ << (now->tm_sec);
+
+ // Give a return code - 0 means success
+ return 0;
+}