File tree 1 file changed +9
-6
lines changed
1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -170,18 +170,21 @@ int Command::exec(std::string wdir) const {
170
170
}
171
171
172
172
void showCompilePhase (std::string msg) {
173
- time_t rawTime;
173
+ time_t rawTime = 0 ;
174
174
struct tm *timeInfo;
175
- char buffer[80 ];
175
+ char buffer[80 ] = " " ;
176
176
// Remember first time.
177
177
static time_t firstRawTime;
178
178
static bool hasFirstRawTime = false ;
179
179
180
180
// Get current date.
181
- time (&rawTime);
182
- timeInfo = localtime (&rawTime);
183
- strftime (buffer, 80 , " %c" , timeInfo);
184
- std::string currentTime (buffer);
181
+ std::string currentTime (" " );
182
+ if (time (&rawTime) == -1 || (timeInfo = localtime (&rawTime)) == NULL ||
183
+ (strftime (buffer, 80 , " %c" , timeInfo)) == 0 ) {
184
+ currentTime = " Error obtaining current time" ;
185
+ } else {
186
+ currentTime = buffer;
187
+ }
185
188
186
189
// Compute time difference in seconds.
187
190
int diff = 0 ;
You can’t perform that action at this time.
0 commit comments