File: main.cxx

package info (click to toggle)
log4cplus 1.0.4-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 3,536 kB
  • sloc: sh: 10,603; cpp: 9,253; ansic: 706; makefile: 251
file content (65 lines) | stat: -rw-r--r-- 1,669 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include <log4cplus/helpers/timehelper.h>
#include <log4cplus/streams.h>
#include <iostream>

using namespace log4cplus;
using namespace log4cplus::helpers;


log4cplus::tchar const fmtstr[] =
    LOG4CPLUS_TEXT("%s, %Q%%q%q %%Q %%q=%%%q%%;%%q, %%Q=%Q");


int
main()
{
    std::cout << "Entering main()..." << std::endl;
    try
    {
        Time time;
        log4cplus::tstring str;

        time = Time::gettimeofday ();
        str = time.getFormattedTime (fmtstr);
        log4cplus::tcout << LOG4CPLUS_TEXT ("now: ") << str << std::endl;

        time = Time (0, 7);
        str = time.getFormattedTime (fmtstr);
        log4cplus::tcout << str << std::endl;

        time = Time (0, 17);
        str = time.getFormattedTime (fmtstr);
        log4cplus::tcout << str << std::endl;

        time = Time (0, 123);
        str = time.getFormattedTime (fmtstr);
        log4cplus::tcout << str << std::endl;

        time = Time (0, 1234);
        str = time.getFormattedTime (fmtstr);
        log4cplus::tcout << str << std::endl;

        time = Time (0, 12345);
        str = time.getFormattedTime (fmtstr);
        log4cplus::tcout << str << std::endl;

        time = Time (0, 123456);
        str = time.getFormattedTime (fmtstr);
        log4cplus::tcout << str << std::endl;

        time = Time (0, 0);
        str = time.getFormattedTime (fmtstr);
        log4cplus::tcout << str << std::endl;
    }
    catch(std::exception const & e)
    {
        std::cout << "Exception: " << e.what () << std::endl;
    }
    catch(...)
    {
        std::cout << "Exception..." << std::endl;
    }

    std::cout << "Exiting main()..." << std::endl;
    return 0;
}