xref: /aosp_15_r20/system/timezone/input_tools/android/tzids/src/main/proto/tz_ids_proto.proto (revision 2fd832c65f8b41db7ddb4ac802b9196762fe4888)
1/*
2 * Copyright (C) 2020 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17syntax = "proto2";
18
19option java_package = "com.android.timezone.tzids.proto";
20option java_multiple_files = false;
21
22package com.android.timezone.tzids.proto;
23
24// Information about Olson IDs used / preferred by Android.
25message TimeZoneIds {
26    // The IANA TZDB version the data was generated from.
27    optional string ianaVersion = 1;
28
29    // Information about IDs that are mapped to ISO 3166 Alpha-2 country codes.
30    repeated CountryMapping countryMappings = 2;
31}
32
33// Information about Olson IDs recognized by Android as being related to a country.
34message CountryMapping {
35    // The ISO 3166 Alpha-2 country code.
36    required string isoCode = 1;
37
38    // The IANA TZDB Olson IDs preferred by Android for the country.
39    repeated string timeZoneIds = 2;
40
41    // Links for time zones that are recognized as being for the country, but are not preferred.
42    // These links are for time zones that have always been equivalent.
43    // e.g. "GB-Eire" is linked to "Europe/London" because "GB-Eire"" is just an obsoleted synonym.
44    repeated TimeZoneLink timeZoneLinks = 3;
45
46    // Replacements for time zones where the replaced time zone is not identical to the replacement
47    // before some point in time. After that point in time, the two zones have been judged as
48    // equivalent. e.g. "America/Boise" has the same rules as "America/Denver" after Sun, 03 Feb
49    // 1974, so the two can be considered equivalent today, but not for dates before that.
50    repeated TimeZoneReplacement timeZoneReplacements = 4;
51}
52
53// An ID replacement when one time zone Olson ID is just direct synonym for another.
54message TimeZoneLink {
55    // The alternative Olson ID. This will typically be an obsoleted Olson ID.
56    required string alternativeId = 1;
57    // The Android preferred Olson ID. This will typically be a newer / more correct Olson ID.
58    required string preferredId = 2;
59}
60
61// The functional replacement of one time zone ID by another after a point in time.
62// Computed by looking at offset behavior / zone metadata.
63message TimeZoneReplacement {
64    // The Olson ID that was replaced / ceased to be distinct.
65    required string replacedId = 1;
66    // The Olson ID that is better / to use in place of replacedId on Android after fromMillis.
67    required string replacementId = 2;
68    // When replacementId replaced replacedId. Milliseconds from the start of the Unix epoch.
69    required int64 fromMillis = 3;
70}
71