namespace WrtDeviceApis {
namespace Commons {
namespace Time {
-
struct tm* localtime_r(long long int* timep, struct tm* result)
{
UErrorCode status = U_ZERO_ERROR;
UCalendar *cal;
- if( !result || !timep )
- {
+ if (!result || !timep) {
return NULL;
}
cal = ucal_open(NULL, 0, NULL, UCAL_DEFAULT, &status);
- if(U_FAILURE(status))
- {
+ if (U_FAILURE(status)) {
return NULL;
}
ucal_setMillis(cal, (*timep * (double)1000.0), &status);
- result->tm_sec = ucal_get(cal, UCAL_SECOND, &status);
- result->tm_min = ucal_get(cal, UCAL_MINUTE, &status);
- result->tm_hour = ucal_get(cal, UCAL_HOUR, &status);
+ result->tm_sec = ucal_get(cal, UCAL_SECOND, &status);
+ result->tm_min = ucal_get(cal, UCAL_MINUTE, &status);
+ result->tm_hour = ucal_get(cal, UCAL_HOUR, &status);
result->tm_mday = ucal_get(cal, UCAL_DAY_OF_MONTH, &status);
- result->tm_mon = ucal_get(cal, UCAL_MONTH, &status);
- result->tm_year = ucal_get(cal, UCAL_YEAR, &status);
- result->tm_wday = ucal_get(cal, UCAL_DAY_OF_WEEK, &status);
- result->tm_yday = ucal_get(cal, UCAL_DAY_OF_YEAR, &status);
- result->tm_isdst= ucal_get(cal, UCAL_DST_OFFSET, &status);
+ result->tm_mon = ucal_get(cal, UCAL_MONTH, &status);
+ result->tm_year = ucal_get(cal, UCAL_YEAR, &status);
+ result->tm_wday = ucal_get(cal, UCAL_DAY_OF_WEEK, &status);
+ result->tm_yday = ucal_get(cal, UCAL_DAY_OF_YEAR, &status);
+ result->tm_isdst = ucal_get(cal, UCAL_DST_OFFSET, &status);
ucal_close(cal);
- if(U_FAILURE(status))
- {
+ if (U_FAILURE(status)) {
return NULL;
- }
- else
- {
+ } else {
return result;
}
}
-
}
}
}