aboutsummaryrefslogtreecommitdiffstats
path: root/brillo/timezone/tzif_parser.h
diff options
context:
space:
mode:
Diffstat (limited to 'brillo/timezone/tzif_parser.h')
-rw-r--r--brillo/timezone/tzif_parser.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/brillo/timezone/tzif_parser.h b/brillo/timezone/tzif_parser.h
new file mode 100644
index 0000000..058079c
--- /dev/null
+++ b/brillo/timezone/tzif_parser.h
@@ -0,0 +1,29 @@
+// Copyright 2020 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef LIBBRILLO_BRILLO_TIMEZONE_TZIF_PARSER_H_
+#define LIBBRILLO_BRILLO_TIMEZONE_TZIF_PARSER_H_
+
+#include <string>
+
+#include <base/files/file_path.h>
+#include <base/optional.h>
+#include <brillo/brillo_export.h>
+
+namespace brillo {
+
+namespace timezone {
+
+// GetPosixTimezone takes a path to a tzfile, and returns the POSIX timezone in
+// a string. See 'man tzfile' for more info on the format. If |tzif_path| is a
+// relative path, it will be appended to /usr/share/zoneinfo/, otherwise
+// |tzif_path| as an absolute path will be used directly.
+base::Optional<std::string> BRILLO_EXPORT GetPosixTimezone(
+ const base::FilePath& tzif_path);
+
+} // namespace timezone
+
+} // namespace brillo
+
+#endif // LIBBRILLO_BRILLO_TIMEZONE_TZIF_PARSER_H_