build_time.cc 748 B

12345678910111213141516171819202122232425
  1. // Copyright (c) 2011 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "base/build_time.h"
  5. // Imports the generated build date, i.e. BUILD_DATE.
  6. #include "base/generated_build_date.h"
  7. #include "base/check.h"
  8. #include "base/time/time.h"
  9. namespace base {
  10. Time GetBuildTime() {
  11. Time integral_build_time;
  12. // BUILD_DATE is exactly "Mmm DD YYYY HH:MM:SS".
  13. // See //build/write_build_date_header.py. "HH:MM:SS" is expected to
  14. // be "05:00:00" in non-official builds but is not enforced here.
  15. bool result = Time::FromUTCString(BUILD_DATE, &integral_build_time);
  16. DCHECK(result);
  17. return integral_build_time;
  18. }
  19. } // namespace base