Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXSystem.h
1 /********************************************************************************
2 * *
3 * M i s c e l l a n e o u s S y s t e m F u n c t i o n s *
4 * *
5 *********************************************************************************
6 * Copyright (C) 2005,2022 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU Lesser General Public License as published by *
10 * the Free Software Foundation; either version 3 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public License *
19 * along with this program. If not, see <http://www.gnu.org/licenses/> *
20 ********************************************************************************/
21 #ifndef FXSYSTEM_H
22 #define FXSYSTEM_H
23 
24 namespace FX {
25 
26 namespace FXSystem {
27 
29  struct Time {
30  FXint year;
31  FXint month;
32  FXint mday;
33  FXint yday;
34  FXint wday;
35  FXint hour;
36  FXint min;
37  FXint sec;
38  FXint nano;
39  FXint offset;
40  };
41 
43  extern FXAPI FXTime timeFromSystemTime(const Time& st);
44 
46  extern FXAPI void systemTimeFromTime(Time& st,FXTime utc);
47 
48 
50  extern FXAPI const FXchar defaultTimeFormat[];
51 
53  extern FXAPI const FXchar isoTimeFormat[];
54 
55 
57  extern FXAPI FXString systemTimeFormat(const Time& st,const FXchar* format=defaultTimeFormat);
58 
60  extern FXAPI FXint systemTimeParse(Time& st,const FXchar* string,const FXchar* format=defaultTimeFormat);
61 
63  extern FXAPI FXint systemTimeParse(Time& st,const FXString& string,const FXchar* format=defaultTimeFormat);
64 
65 
71  extern FXAPI FXlong daysFromCivil(FXint y,FXint m,FXint d);
72 
79  extern FXAPI void civilFromDays(FXint& y,FXint& m,FXint& d,FXlong z);
80 
81 
83  extern FXAPI FXival leapSeconds(FXTime utc);
84 
86  extern FXAPI FXival leapSecondsTAI(FXTime tai);
87 
89  extern FXAPI FXTime localTimeZoneOffset();
90 
92  extern FXAPI FXTime daylightSavingsOffset();
93 
95  extern FXAPI FXTime daylightSavingsActive(FXTime utc);
96 
98  extern FXAPI FXString localTimeZoneName(FXbool dst=false);
99 
100 
102  extern FXAPI FXTime timeFromNTPTime(FXulong ntptime);
103 
105  extern FXAPI FXulong ntpTimeFromTime(FXTime utc);
106 
107 
109  extern FXAPI FXString universalTime(FXTime utc,const FXchar *format=defaultTimeFormat);
110 
112  extern FXAPI FXTime universalTime(const FXchar* string,const FXchar* format=defaultTimeFormat);
113  extern FXAPI FXTime universalTime(const FXString& string,const FXchar* format=defaultTimeFormat);
114 
115 
117  extern FXAPI FXString localTime(FXTime utc,const FXchar *format=defaultTimeFormat);
118 
120  extern FXAPI FXTime localTime(const FXchar* string,const FXchar* format=defaultTimeFormat);
121  extern FXAPI FXTime localTime(const FXString& string,const FXchar* format=defaultTimeFormat);
122 
123 
125  extern FXAPI FXuint user();
126 
128  extern FXAPI FXuint group();
129 
131  extern FXAPI FXString userName(FXuint uid);
132 
134  extern FXAPI FXString groupName(FXuint gid);
135 
137  extern FXAPI FXString currentUserName();
138 
140  extern FXAPI FXString currentGroupName();
141 
142 
144  extern FXAPI FXString modeString(FXuint mode);
145 
146 
148  extern FXAPI FXString getEnvironment(const FXString& name);
149 
151  extern FXAPI FXbool setEnvironment(const FXString& name,const FXString& value);
152 
153 
155  extern FXAPI FXString getCurrentDirectory();
156 
158  extern FXAPI FXbool setCurrentDirectory(const FXString& path);
159 
161  extern FXAPI FXString getCurrentDrive();
162 
164  extern FXAPI FXbool setCurrentDrive(const FXString& prefix);
165 
166 
168  extern FXAPI FXString getExecPath();
169 
171  extern FXAPI FXString getExecExtensions();
172 
174  extern FXAPI FXString getExecFilename();
175 
177  extern FXAPI FXString getHomeDirectory();
178 
180  extern FXAPI FXString getTempDirectory();
181 
183  extern FXAPI FXString getSystemDirectory();
184 
186  extern FXAPI FXString getUserDirectory(const FXString& user);
187 
188 
190  extern FXAPI FXint system(const FXString& cmd);
191 
193  extern FXAPI FXString getHostName();
194 
195 
197  extern FXAPI FXbool localeIsUTF8();
198 
203  extern FXAPI FXString dllName(const FXString& name);
204  }
205 
206 }
207 
208 #endif
FXint mday
Month 1..12.
Definition: FXSystem.h:32
FXint sec
Minutes 0..59.
Definition: FXSystem.h:37
FXint min
Hours 0..23.
Definition: FXSystem.h:36
FXint wday
Day in the year 1..366.
Definition: FXSystem.h:34
System Time in parts.
Definition: FXSystem.h:29
Definition: FX4Splitter.h:28
FXint month
Year (e.g. 1970)
Definition: FXSystem.h:31
FXint hour
Day of the week 0..6.
Definition: FXSystem.h:35
FXint nano
Seconds 0..60.
Definition: FXSystem.h:38
FXint offset
Nanoseconds 0..999999999.
Definition: FXSystem.h:39
FXint yday
Day of the month 1..31.
Definition: FXSystem.h:33
FXString provides essential string manipulation capabilities in FOX.
Definition: FXString.h:42

Copyright © 1997-2022 Jeroen van der Zijp