#include "base/time/time.h"
#include <memory>
#include "base/check.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/numerics/clamped_math.h"
#include "build/build_config.h"
#include "third_party/icu/source/common/unicode/locid.h"
#include "third_party/icu/source/i18n/unicode/calendar.h"
#include "third_party/icu/source/i18n/unicode/gregocal.h"
#include "third_party/icu/source/i18n/unicode/timezone.h"
namespace base {
namespace {
std::unique_ptr<icu::Calendar> CreateCalendar(bool is_local) { … }
bool ExplodeUsingIcuCalendar(int64_t millis_since_unix_epoch,
bool is_local,
Time::Exploded* exploded) { … }
}
void Time::ExplodeUsingIcu(int64_t millis_since_unix_epoch,
bool is_local,
Exploded* exploded) { … }
bool Time::FromExplodedUsingIcu(bool is_local,
const Exploded& exploded,
int64_t* millis_since_unix_epoch) { … }
#if BUILDFLAG(IS_FUCHSIA)
void Time::Explode(bool is_local, Exploded* exploded) const {
return ExplodeUsingIcu(ToRoundedDownMillisecondsSinceUnixEpoch(), is_local,
exploded);
}
bool Time::FromExploded(bool is_local, const Exploded& exploded, Time* time) {
int64_t millis_since_unix_epoch;
if (FromExplodedUsingIcu(is_local, exploded, &millis_since_unix_epoch))
return FromMillisecondsSinceUnixEpoch(millis_since_unix_epoch, time);
*time = Time(0);
return false;
}
#endif
}