Jpp  15.0.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
JDate.cc File Reference

Example program to show system time. More...

#include <string>
#include <iostream>
#include <iomanip>
#include "JSystem/JDate.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"
#include "Jeep/JPrint.hh"

Go to the source code of this file.

Functions

int main (int argc, char *argv[])
 

Detailed Description

Example program to show system time.

Author
mdejong

Definition in file JDate.cc.

Function Documentation

int main ( int  argc,
char *  argv[] 
)

Definition at line 17 of file JDate.cc.

18 {
19  using namespace std;
20  using namespace JPP;
21 
22  int option;
23 
24  try {
25 
26  JParser<> zap("Example program to show system time.");
27 
28  zap['O'] = make_field(option, "formatting option (0: human-readable; 1: ISO-8601");
29 
30  zap(argc, argv);
31  }
32  catch(const exception &error) {
33  FATAL(error.what() << endl);
34  }
35 
36  JDateAndTimeFormat format = (JDateAndTimeFormat)option;
37 
38  cout << getDate(format) << endl;
39  cout << getTime(format) << endl;
40  cout << getDateAndTime().toString(format) << endl;
41 
42  JDateAndTime cal;
43 
44  cout << cal.getYear() << '/' << FILL(2,'0') << cal.getMonth() << '/' << FILL(2,'0') << cal.getDay() << endl;
45 }
Utility class to parse command line options.
Definition: JParser.hh:1500
JDateAndTimeFormat
Date and time formats.
double getTime(const Hit &hit)
Get true time of hit.
std::string toString(const JDateAndTimeFormat option=ISO8601) const
Get ASCII formatted date and time.
static JDateAndTime getDateAndTime
Function object to get ASCII formatted date and time.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1961
const char * getDate(const JDateAndTimeFormat option=ISO8601)
Get ASCII formatted date.
Auxiliary data structure for sequence of same character.
Definition: JManip.hh:328
#define FATAL(A)
Definition: JMessage.hh:67