1 | #include "sopnamsp.h"
|
---|
2 | #include "machdefs.h"
|
---|
3 | #include <stdio.h>
|
---|
4 | #include <stdlib.h>
|
---|
5 | #include "math.h"
|
---|
6 | #include <iostream>
|
---|
7 | #include <string>
|
---|
8 |
|
---|
9 | #include <typeinfo>
|
---|
10 | #include "timing.h"
|
---|
11 | #include "timestamp.h"
|
---|
12 | #include "histinit.h"
|
---|
13 | #include "pexceptions.h"
|
---|
14 |
|
---|
15 | /* Programme test de la classe TimeStamp */
|
---|
16 | /* SOPHYA - R. Ansari (LAL) - Mars 2005 */
|
---|
17 |
|
---|
18 | int main(int narg, char* arg[])
|
---|
19 | {
|
---|
20 | cout << " ---- Programme ttimestamp.cc - Test classe TimeStamp --- " << endl;
|
---|
21 | int rc = 0;
|
---|
22 | try {
|
---|
23 | SophyaInit();
|
---|
24 | // PPRegister(FIO_SphereECP<r_8>);
|
---|
25 | // DObjRegister(FIO_SphereECP<r_8>, SphereECP<r_8>);
|
---|
26 |
|
---|
27 | InitTim();
|
---|
28 | cout << " Sizeof(TimeStamp=) " << sizeof(TimeStamp) << endl;
|
---|
29 | TimeStamp ts;
|
---|
30 | cout << "ts: Now : " << ts << "(->double: " << (double)ts << " )" << endl;
|
---|
31 | TimeStamp ts2("26/8/1974","14:22:35.65");
|
---|
32 | cout << "ts2: 26/8/1974 14:22:35.65 : " << ts2
|
---|
33 | << " double->TimeStamp: " << TimeStamp(ts2.ToDays()) << endl;
|
---|
34 | TimeStamp ts3("01/01/1905","00:00:00");
|
---|
35 | cout << "ts3: 01/01/1905 , 00:00:00 : " << ts3 << " (double): "
|
---|
36 | << (double)ts3 << " double->TimeStamp: " << TimeStamp(ts3.ToDays()) << endl;
|
---|
37 | TimeStamp ts4("01/01/1901","03:00:20");
|
---|
38 | cout << "ts3: 01/01/1901 , 03:00:20 : " << ts4 << " (double): "
|
---|
39 | << (double)ts4 << " double->TimeStamp: " << TimeStamp(ts4.ToDays()) << endl;
|
---|
40 |
|
---|
41 | TimeStamp ts5("01/12/1899","00:00:00");
|
---|
42 | cout << "ts5: 01/12/1899 , 00:00:00 : " << ts5 << " (double): "
|
---|
43 | << (double)ts5 << " double->TimeStamp: " << TimeStamp(ts5.ToDays()) << endl;
|
---|
44 | TimeStamp ts6("01/12/1899","15:30:00");
|
---|
45 | cout << "ts6: 01/12/1899 , 15:30:00 : " << ts6 << " (double): "
|
---|
46 | << (double)ts6 << " double->TimeStamp: " << TimeStamp(ts6.ToDays()) << endl;
|
---|
47 | cout << " ts.ToString(bool, bool) test : " << endl;
|
---|
48 | cout << " ts.ToString()= " << ts.ToString() << endl;
|
---|
49 | cout << " ts.ToString(fgd=true, fgh=false)= " << ts.ToString(true, false) << endl;
|
---|
50 | cout << " ts.ToString(fgd=false, fgh=true)= " << ts.ToString(false, true) << endl;
|
---|
51 |
|
---|
52 | }
|
---|
53 | catch (PThrowable & exc) {
|
---|
54 | cerr << " ttimestamp.cc: Catched Exception (PThrowable)" << (string)typeid(exc).name()
|
---|
55 | << " - Msg= " << exc.Msg() << endl;
|
---|
56 | rc = 99;
|
---|
57 | }
|
---|
58 | catch (std::exception & e) {
|
---|
59 | cerr << " ttimestamp.cc: Catched std::xception "
|
---|
60 | << " - what()= " << e.what() << endl;
|
---|
61 | rc = 98;
|
---|
62 | }
|
---|
63 | catch (...) {
|
---|
64 | cerr << " ttimestamp.cc: some other exception (...) was caught ! " << endl;
|
---|
65 | rc = 97;
|
---|
66 | }
|
---|
67 | PrtTim("End ttimestamp " );
|
---|
68 | cout << " ---- Programme ttimestamp.cc- FIN (Rc=" << rc << ") --- " << endl;
|
---|
69 | return rc;
|
---|
70 | }
|
---|