Jpp
18.0.0
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
JDateAndTime.cc
Go to the documentation of this file.
1
#include <string>
2
#include <iostream>
3
#include <iomanip>
4
5
#include "
JSystem/JDateAndTime.hh
"
6
7
#include "
Jeep/JParser.hh
"
8
#include "
Jeep/JMessage.hh
"
9
#include "
Jeep/JPrint.hh
"
10
11
12
/**
13
* \file
14
*
15
* Example program to show system time.
16
* \author mdejong
17
*/
18
int
main
(
int
argc,
char
* argv[])
19
{
20
using namespace
std;
21
using namespace
JPP;
22
23
time_t utc_s;
24
25
try
{
26
27
JParser<>
zap(
"Example program to show system time."
);
28
29
zap[
'T'
] =
make_field
(utc_s,
"UTC time [s]"
);
30
31
zap(argc, argv);
32
}
33
catch
(
const
exception &error) {
34
FATAL
(error.what() << endl);
35
}
36
37
cout <<
"current:"
<< endl;
38
cout <<
getDate
() << endl;
39
cout <<
getTime
() << endl;
40
cout <<
getDateAndTime
().
toString
() << endl;
41
42
JDateAndTime cal;
43
44
cout << cal.getYear() <<
'/'
<<
FILL
(2,
'0'
) << cal.getMonth() <<
'/'
<<
FILL
(2,
'0'
) << cal.getDay() << endl;
45
46
cout <<
"user:"
<< endl;
47
cout << JDateAndTime(utc_s,
true
).toString() << endl;
48
}
JPARSER::JParser
Utility class to parse command line options.
Definition:
JParser.hh:1514
main
int main(int argc, char *argv[])
Definition:
Main.cc:15
JSYSTEM::JDateAndTime::toString
std::string toString() const
Get ASCII formatted date and time.
Definition:
JDateAndTime.hh:215
JAANET::getTime
double getTime(const Hit &hit)
Get true time of hit.
Definition:
JAAnetToolkit.hh:93
JDateAndTime.hh
Date and time functions.
JSYSTEM::getDateAndTime
static JDateAndTime getDateAndTime
Function object to get current date and time.
Definition:
JDateAndTime.hh:468
JPrint.hh
I/O formatting auxiliaries.
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition:
JParser.hh:1989
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
JSYSTEM::getDate
const char * getDate()
Get current local date conform ISO-8601 standard.
Definition:
JDateAndTime.hh:36
JParser.hh
Utility class to parse command line options.
Generated by
1.8.5