@@ -40,8 +40,6 @@ namespace WPEFramework
40
40
mTimeQuality(TIME_QUALITY_STALE),
41
41
mTimeZone(),
42
42
mTimeZoneAccuracyString(),
43
- mTimeZoneAccuracy(ACC_UNDEFINED),
44
- mTimeZoneOffsetSec(0 ),
45
43
mTransitionMap(),
46
44
mIsSystemTimeAvailable(false ),
47
45
mShell(shell)
@@ -98,20 +96,28 @@ namespace WPEFramework
98
96
}
99
97
}
100
98
101
- LOGINFO (" IsSystemTimeAvailable: %d" , isAvailable);
102
99
return isAvailable;
103
100
}
104
101
105
102
SystemTime::TimeZoneAccuracy SystemTime::GetTimeZoneOffset (int32_t &offsetSec)
106
103
{
107
- SystemTime::TimeZoneAccuracy accuracy = ACC_UNDEFINED;
104
+ std::string tz;
105
+ std::string accuracyString;
106
+ bool isTimeAvailable = false ;
108
107
{
109
108
std::lock_guard<std::mutex> guard (mLock );
110
- offsetSec = mTimeZoneOffsetSec ;
111
- accuracy = mTimeZoneAccuracy ;
109
+ tz = mTimeZone ;
110
+ accuracyString = mTimeZoneAccuracyString ;
111
+ isTimeAvailable = mIsSystemTimeAvailable ;
112
112
}
113
113
114
- return accuracy;
114
+ if (isTimeAvailable)
115
+ {
116
+ std::pair<SystemTime::TimeZoneAccuracy, int32_t > tzParsed = ParseTimeZone (tz, accuracyString);
117
+ offsetSec = tzParsed.second ;
118
+ return tzParsed.first ;
119
+ }
120
+ return ACC_UNDEFINED;
115
121
}
116
122
117
123
void SystemTime::onTimeStatusChanged (const JsonObject& parameters)
@@ -231,11 +237,8 @@ namespace WPEFramework
231
237
std::lock_guard<std::mutex> guard (mLock );
232
238
if (mTimeZone != tz || mTimeZoneAccuracyString != accuracy)
233
239
{
234
- std::pair<SystemTime::TimeZoneAccuracy, int32_t > tzParsed = ParseTimeZone (tz, accuracy);
235
240
mTimeZone = tz;
236
241
mTimeZoneAccuracyString = accuracy;
237
- mTimeZoneAccuracy = tzParsed.first ;
238
- mTimeZoneOffsetSec = tzParsed.second ;
239
242
}
240
243
}
241
244
}
@@ -264,7 +267,6 @@ namespace WPEFramework
264
267
if (timeZone == " Universal" )
265
268
{
266
269
result.second = 0 ;
267
- LOGINFO (" timeZoneOff: %d" , result.second );
268
270
return result;
269
271
}
270
272
@@ -282,13 +284,11 @@ namespace WPEFramework
282
284
if (currentTimeEndItr != mTransitionMap .end ())
283
285
{
284
286
result.second = currentTimeEndItr->second ;
285
- LOGINFO (" timeZoneOff: %d" , result.second );
286
287
}
287
288
else if (mTransitionMap .empty () == false )
288
289
{
289
290
currentTimeEndItr--; // take the last transition when all transitions are from past
290
291
result.second = currentTimeEndItr->second ;
291
- LOGINFO (" timeZoneOff: %d" , result.second );
292
292
}
293
293
else
294
294
{
@@ -398,10 +398,6 @@ namespace WPEFramework
398
398
LOGERR (" v_secure_popen of zdump -v %s failed" , mTimeZone .c_str ());
399
399
}
400
400
}
401
- else
402
- {
403
- LOGINFO (" No update required" );
404
- }
405
401
}
406
402
407
403
@@ -467,11 +463,8 @@ namespace WPEFramework
467
463
std::lock_guard<std::mutex> guard (mLock );
468
464
if (mTimeZone != tz || mTimeZoneAccuracyString != accuracy)
469
465
{
470
- std::pair<SystemTime::TimeZoneAccuracy, int32_t > tzParsed = ParseTimeZone (tz, accuracy);
471
466
mTimeZone = tz;
472
467
mTimeZoneAccuracyString = accuracy;
473
- mTimeZoneAccuracy = tzParsed.first ;
474
- mTimeZoneOffsetSec = tzParsed.second ;
475
468
}
476
469
}
477
470
}
0 commit comments