xref: /aosp_15_r20/external/libbrillo/brillo/timezone/tzif_parser.h (revision 1a96fba65179ea7d3f56207137718607415c5953)
1 // Copyright 2020 The Chromium OS 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 
5 #ifndef LIBBRILLO_BRILLO_TIMEZONE_TZIF_PARSER_H_
6 #define LIBBRILLO_BRILLO_TIMEZONE_TZIF_PARSER_H_
7 
8 #include <string>
9 
10 #include <base/files/file_path.h>
11 #include <base/optional.h>
12 #include <brillo/brillo_export.h>
13 
14 namespace brillo {
15 
16 namespace timezone {
17 
18 // GetPosixTimezone takes a path to a tzfile, and returns the POSIX timezone in
19 // a string. See 'man tzfile' for more info on the format. If |tzif_path| is a
20 // relative path, it will be appended to /usr/share/zoneinfo/, otherwise
21 // |tzif_path| as an absolute path will be used directly.
22 base::Optional<std::string> BRILLO_EXPORT GetPosixTimezone(
23         const base::FilePath& tzif_path);
24 
25 }  // namespace timezone
26 
27 }  // namespace brillo
28 
29 #endif  // LIBBRILLO_BRILLO_TIMEZONE_TZIF_PARSER_H_
30