1 |
Douglas Thrift |
53 |
// Time Zones |
2 |
|
|
// |
3 |
|
|
// Douglas Thrift |
4 |
|
|
// |
5 |
|
|
// $Id$ |
6 |
|
|
|
7 |
|
|
#ifndef _TimeZones_hpp_ |
8 |
|
|
#define _TimeZones_hpp_ |
9 |
|
|
|
10 |
|
|
#include <iostream> |
11 |
Douglas Thrift |
55 |
#include <fstream> |
12 |
Douglas Thrift |
53 |
#include <string> |
13 |
Douglas Thrift |
55 |
#include <list> |
14 |
Douglas Thrift |
53 |
#include <cstdlib> |
15 |
|
|
#include <cstdio> |
16 |
|
|
#include <ctime> |
17 |
|
|
|
18 |
|
|
using namespace std; |
19 |
|
|
|
20 |
|
|
inline string sgetenv(const string& name) |
21 |
|
|
{ |
22 |
|
|
char* value = getenv(name.c_str()); |
23 |
|
|
|
24 |
|
|
return value != NULL ? value : ""; |
25 |
|
|
} |
26 |
|
|
|
27 |
|
|
inline int sputenv(const string& name) |
28 |
|
|
{ |
29 |
|
|
char* value = new char[name.size() + 1]; |
30 |
|
|
|
31 |
|
|
sprintf(value, name.c_str()); |
32 |
|
|
|
33 |
|
|
int code = putenv(value); |
34 |
|
|
|
35 |
|
|
delete [] value; |
36 |
|
|
|
37 |
|
|
return code; |
38 |
|
|
} |
39 |
|
|
|
40 |
|
|
inline void sunsetenv(const string& name) { unsetenv(name.c_str()); } |
41 |
|
|
|
42 |
|
|
class TimeZones |
43 |
|
|
{ |
44 |
|
|
private: |
45 |
Douglas Thrift |
55 |
time_t now; |
46 |
|
|
void display(); |
47 |
|
|
void display(const string& location, const string& zone); |
48 |
Douglas Thrift |
53 |
public: |
49 |
|
|
TimeZones(); |
50 |
|
|
~TimeZones() {} |
51 |
|
|
}; |
52 |
|
|
|
53 |
|
|
#endif // _TimeZones_hpp_ |