Jpp
15.0.3
the software that should make you happy
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
examples
JSystem
JDate.cc
Go to the documentation of this file.
1
#include <string>
2
#include <iostream>
3
#include <iomanip>
4
5
#include "
JSystem/JDate.hh
"
6
#include "
Jeep/JParser.hh
"
7
#include "
Jeep/JMessage.hh
"
8
#include "
Jeep/JPrint.hh
"
9
10
11
/**
12
* \file
13
*
14
* Example program to show system time.
15
* \author mdejong
16
*/
17
int
main
(
int
argc,
char
* argv[])
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
}
JPARSER::JParser
Utility class to parse command line options.
Definition:
JParser.hh:1500
main
int main(int argc, char *argv[])
Definition:
Main.cc:15
JSYSTEM::JDateAndTimeFormat
JDateAndTimeFormat
Date and time formats.
Definition:
JSystem/JDate.hh:23
JAANET::getTime
double getTime(const Hit &hit)
Get true time of hit.
Definition:
JAAnetToolkit.hh:84
JSYSTEM::JDateAndTime::toString
std::string toString(const JDateAndTimeFormat option=ISO8601) const
Get ASCII formatted date and time.
Definition:
JSystem/JDate.hh:194
JDate.hh
Date and time functions.
JSYSTEM::getDateAndTime
static JDateAndTime getDateAndTime
Function object to get ASCII formatted date and time.
Definition:
JSystem/JDate.hh:295
JPrint.hh
I/O formatting auxiliaries.
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition:
JParser.hh:1961
JSYSTEM::getDate
const char * getDate(const JDateAndTimeFormat option=ISO8601)
Get ASCII formatted date.
Definition:
JSystem/JDate.hh:35
JMessage.hh
General purpose messaging.
FILL
Auxiliary data structure for sequence of same character.
Definition:
JManip.hh:328
FATAL
#define FATAL(A)
Definition:
JMessage.hh:67
JParser.hh
Utility class to parse command line options.
Generated by
1.8.5