From b25fb0fa4afb8bc031982c7ace7ac5ea819e35c4 Mon Sep 17 00:00:00 2001 From: Jordan Power Date: Wed, 26 Nov 2014 20:32:20 +0000 Subject: Created basic C++ file for retrieving and posting the current time. --- timecommand.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 timecommand.cpp 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 +#include +#include + +// 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; +} -- cgit v1.2.3