1use crate::LiteStr;
2
3pub static UTC_ALIASES: &[&str] = &[
4 "Etc/UCT",
5 "Etc/UTC",
6 "Etc/Universal",
7 "Etc/Zulu",
8 "UCT",
9 "UTC",
10 "Universal",
11 "Zulu",
12];
13
14pub fn tz_names() -> impl Iterator<Item = LiteStr<49>> {
16 #[cfg(feature = "alloc")]
17 {
18 tz_names_alloc()
19 }
20 #[cfg(not(feature = "alloc"))]
21 {
22 tz_names_no_alloc()
23 }
24}
25
26#[cfg(feature = "alloc")]
28fn tz_names_alloc() -> impl Iterator<Item = LiteStr<49>> {
29 #[cfg(feature = "jiff-tz")]
30 {
31 jiff::tz::db()
32 .available()
33 .map(|s| LiteStr::new(&s.to_string()))
34 }
35 #[cfg(not(feature = "jiff-tz"))]
36 {
37 UTC_ALIASES.iter().copied().map(LiteStr::new)
38 }
39}
40
41#[cfg(not(feature = "alloc"))]
43fn tz_names_no_alloc() -> impl Iterator<Item = LiteStr<49>> {
44 UTC_ALIASES.iter().copied().map(LiteStr::new)
45}