1 // ANNA - Anna is Not Nothingness Anymore //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo //
5 // See project site at http://redmine.teslayout.com/projects/anna-suite //
6 // See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
14 #include <anna/time/Date.hpp>
15 #include <anna/time/functions.hpp>
19 void F_exit(const char *message) {
20 std::cout << std::endl;
21 std::cout << std::endl;
22 std::cout << message << std::endl;
23 std::cout << std::endl;
24 std::cout << std::endl;
28 int main(int argc, char** argv) {
29 anna::time::functions::initialize();
30 std::cout << std::endl;
31 std::cout << std::endl;
32 std::cout << "BASIC CONVERSIONS" << std::endl;
36 std::string msg = "Usage: ";
38 msg += " [-unix <unix timestamp>] [-ntp <ntp timestamp>] [-yyyymmddHHmmss <yyyymmddHHmmss (in the system timezone)>]";
42 std::string option = argv[1];
44 if (option != "-unix" && option != "-ntp" && option != "-yyyymmddHHmmss") F_exit("Only -unix/-ntp/-yyyymmddHHmmss options supported !");
48 F_exit("Missing value parameter !");
51 std::string value = argv[2];
55 if (option == "-unix") {
56 aux.storeUnix(atoi(value.c_str()));
57 } else if (option == "-ntp") {
58 aux.storeNtp(atoi(value.c_str()));
59 } else if (option == "-yyyymmddHHmmss") {
63 std::cout << aux.asString() << std::endl;