diff options
author | Jordan Power <ayporosjsy@yahoo.co.uk> | 2014-11-26 20:32:20 +0000 |
---|---|---|
committer | Jordan Power <ayporosjsy@yahoo.co.uk> | 2014-11-26 20:32:20 +0000 |
commit | b25fb0fa4afb8bc031982c7ace7ac5ea819e35c4 (patch) | |
tree | d0c20da259ae76e1b6c731acd62526e518f78f33 | |
parent | 76734b54aeb4277ce07dde526aff0af69ec694a9 (diff) |
Created basic C++ file for retrieving and posting the current time.
-rw-r--r-- | timecommand.cpp | 28 |
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; +} |