diff options
| author | Namilskyy <alive6863@gmail.com> | 2025-11-22 22:23:38 +0300 |
|---|---|---|
| committer | Namilskyy <alive6863@gmail.com> | 2025-11-22 22:52:57 +0300 |
| commit | df581338516220da499857b2c7af8d4d7fe5788a (patch) | |
| tree | 1ab3a26cd78954a0cda86d6d815255508bee94a0 /src/parser.rs | |
| parent | 2e6320185ba358368506fd8b8f2fdae9763447b0 (diff) | |
Added timezone in config
Diffstat (limited to 'src/parser.rs')
| -rw-r--r-- | src/parser.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/parser.rs b/src/parser.rs index 8def9c2..06afce7 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -30,6 +30,7 @@ pub async fn parse_weather() -> Result<WeatherData, Box<dyn std::error::Error>> "hourly", "temperature_2m,relative_humidity_2m,wind_speed_10m".to_string(), ), + ("timezone", config.timezone.unwrap_or("Europe/London".to_string())), ]) .send() .await?; @@ -55,6 +56,7 @@ pub struct Config { lat: f64, lon: f64, exclude: String, + timezone: Option<String>, } pub fn get_config() -> Result<Config, Box<dyn std::error::Error>> { @@ -92,7 +94,7 @@ pub fn generate_cachedir() -> Result<(), Box<dyn std::error::Error>> { /// exclude = "" pub fn generate_config() -> Result<(), Box<dyn std::error::Error>> { let config_path = get_config_path()?; - let config = "lat = 55.75\nlon = 37.62\nexclude = \"\""; + let config = "lat = 55.75\nlon = 37.62\nexclude = \"\"\ntimezone = \"Europe/Moscow\""; let path = std::path::Path::new(&config_path); if let Some(parent) = path.parent() { fs::create_dir_all(parent)?; |
