[2655] | 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 |
|
---|
[2659] | 15 | /* Programme test de la classe TimeStamp */
|
---|
| 16 | /* SOPHYA - R. Ansari (LAL) - Mars 2005 */
|
---|
| 17 |
|
---|
[2655] | 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();
|
---|
[2828] | 28 | cout << " Sizeof(TimeStamp=) " << sizeof(TimeStamp) << endl;
|
---|
[2655] | 29 | TimeStamp ts;
|
---|
[2828] | 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;
|
---|
[2655] | 34 | TimeStamp ts3("01/01/1905","00:00:00");
|
---|
[2828] | 35 | cout << "ts3: 01/01/1905 , 00:00:00 : " << ts3 << " (double): "
|
---|
| 36 | << (double)ts3 << " double->TimeStamp: " << TimeStamp(ts3.ToDays()) << endl;
|
---|
[2655] | 37 | TimeStamp ts4("01/01/1901","03:00:20");
|
---|
[2828] | 38 | cout << "ts3: 01/01/1901 , 03:00:20 : " << ts4 << " (double): "
|
---|
| 39 | << (double)ts4 << " double->TimeStamp: " << TimeStamp(ts4.ToDays()) << endl;
|
---|
[2655] | 40 |
|
---|
[2828] | 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;
|
---|
[2655] | 51 |
|
---|
| 52 | }
|
---|
| 53 | catch (PThrowable & exc) {
|
---|
[2659] | 54 | cerr << " ttimestamp.cc: Catched Exception (PThrowable)" << (string)typeid(exc).name()
|
---|
[2655] | 55 | << " - Msg= " << exc.Msg() << endl;
|
---|
| 56 | rc = 99;
|
---|
| 57 | }
|
---|
| 58 | catch (std::exception & e) {
|
---|
[2659] | 59 | cerr << " ttimestamp.cc: Catched std::xception "
|
---|
[2655] | 60 | << " - what()= " << e.what() << endl;
|
---|
| 61 | rc = 98;
|
---|
| 62 | }
|
---|
| 63 | catch (...) {
|
---|
[2659] | 64 | cerr << " ttimestamp.cc: some other exception (...) was caught ! " << endl;
|
---|
[2655] | 65 | rc = 97;
|
---|
| 66 | }
|
---|
[2659] | 67 | PrtTim("End ttimestamp " );
|
---|
| 68 | cout << " ---- Programme ttimestamp.cc- FIN (Rc=" << rc << ") --- " << endl;
|
---|
[2655] | 69 | return rc;
|
---|
| 70 | }
|
---|