1 |
// Time Zones |
2 |
// |
3 |
// Douglas Thrift |
4 |
// |
5 |
// $Id$ |
6 |
|
7 |
#ifndef _TimeZones_hpp_ |
8 |
#define _TimeZones_hpp_ |
9 |
|
10 |
#include <iostream> |
11 |
#include <fstream> |
12 |
#include <string> |
13 |
#include <list> |
14 |
#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 |
return code; |
36 |
} |
37 |
|
38 |
class TimeZones |
39 |
{ |
40 |
private: |
41 |
time_t now; |
42 |
void display(); |
43 |
void display(const string& location, const string& zone); |
44 |
public: |
45 |
TimeZones(); |
46 |
~TimeZones() {} |
47 |
}; |
48 |
|
49 |
#endif // _TimeZones_hpp_ |