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,2025 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 
56  extern FXAPI const FXchar mainTimeFormat[];
57 
58 
60  extern FXAPI FXString systemTimeFormat(const Time& st,const FXchar* format=defaultTimeFormat);
61 
63  extern FXAPI FXint systemTimeParse(Time& st,const FXchar* string,const FXchar* format=defaultTimeFormat);
64 
66  extern FXAPI FXint systemTimeParse(Time& st,const FXString& string,const FXchar* format=defaultTimeFormat);
67 
68 
74  extern FXAPI FXlong daysFromCivil(FXint y,FXint m,FXint d);
75 
82  extern FXAPI void civilFromDays(FXint& y,FXint& m,FXint& d,FXlong z);
83 
84 
86  extern FXAPI FXival leapSeconds(FXTime utc);
87 
89  extern FXAPI FXival leapSecondsTAI(FXTime tai);
90 
92  extern FXAPI FXTime localTimeZoneOffset();
93 
95  extern FXAPI FXTime daylightSavingsOffset();
96 
98  extern FXAPI FXTime daylightSavingsActive(FXTime utc);
99 
101  extern FXAPI FXString localTimeZoneName(FXbool dst=false);
102 
103 
105  extern FXAPI FXTime timeFromNTPTime(FXulong ntptime);
106 
108  extern FXAPI FXulong ntpTimeFromTime(FXTime utc);
109 
110 
112  extern FXAPI FXString universalTime(FXTime utc,const FXchar *format=defaultTimeFormat);
113 
115  extern FXAPI FXTime universalTime(const FXchar* string,const FXchar* format=defaultTimeFormat);
116  extern FXAPI FXTime universalTime(const FXString& string,const FXchar* format=defaultTimeFormat);
117 
118 
120  extern FXAPI FXString localTime(FXTime utc,const FXchar *format=defaultTimeFormat);
121 
123  extern FXAPI FXTime localTime(const FXchar* string,const FXchar* format=defaultTimeFormat);
124  extern FXAPI FXTime localTime(const FXString& string,const FXchar* format=defaultTimeFormat);
125 
126 
128  extern FXAPI FXuint user();
129 
131  extern FXAPI FXuint group();
132 
134  extern FXAPI FXString userName(FXuint uid);
135 
137  extern FXAPI FXString groupName(FXuint gid);
138 
140  extern FXAPI FXString currentUserName();
141 
143  extern FXAPI FXString currentGroupName();
144 
145 
147  extern FXAPI FXString modeString(FXuint mode);
148 
149 
151  extern FXAPI FXString getEnvironment(const FXString& name);
152 
154  extern FXAPI FXbool setEnvironment(const FXString& name,const FXString& value);
155 
156 
158  extern FXAPI FXbool setCurrentDirectory(const FXString& path);
159 
161  extern FXAPI FXString getCurrentDirectory();
162 
164  extern FXAPI FXbool setCurrentDrive(const FXString& prefix);
165 
167  extern FXAPI FXString getCurrentDrive();
168 
169 
170 
172  extern FXAPI FXString getExecPath();
173 
175  extern FXAPI FXString getExecExtensions();
176 
178  extern FXAPI FXString getExecFilename();
179 
181  extern FXAPI FXString getHomeDirectory();
182 
184  extern FXAPI FXString getTempDirectory();
185 
187  extern FXAPI FXString getSystemDirectory();
188 
190  extern FXAPI FXString getUserDirectory(const FXString& user);
191 
192 
194  extern FXAPI FXint system(const FXString& cmd);
195 
197  extern FXAPI FXString getHostName();
198 
199 
201  extern FXAPI FXbool localeIsUTF8();
202 
207  extern FXAPI FXString dllName(const FXString& name);
208  }
209 
210 }
211 
212 #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