Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -43,17 +43,15 @@ def get_local_time(lat, lon):
|
|
| 43 |
try:
|
| 44 |
tz = pytz.timezone(timezone_str)
|
| 45 |
local_dt = datetime.now(tz)
|
| 46 |
-
print(f"
|
| 47 |
return local_dt
|
| 48 |
except Exception as e:
|
| 49 |
-
print("
|
| 50 |
-
# Return system local time if timezone lookup fails
|
| 51 |
-
return datetime.now()
|
| 52 |
else:
|
| 53 |
-
print("
|
| 54 |
-
return datetime.now()
|
| 55 |
-
|
| 56 |
|
|
|
|
|
|
|
| 57 |
|
| 58 |
# Session setup
|
| 59 |
if "history" not in st.session_state:
|
|
|
|
| 43 |
try:
|
| 44 |
tz = pytz.timezone(timezone_str)
|
| 45 |
local_dt = datetime.now(tz)
|
| 46 |
+
print(f"[✔] Detected Timezone: {timezone_str}")
|
| 47 |
return local_dt
|
| 48 |
except Exception as e:
|
| 49 |
+
print(f"[⚠] Error loading timezone: {e}")
|
|
|
|
|
|
|
| 50 |
else:
|
| 51 |
+
print("[⚠] Timezone not found. Falling back to UTC.")
|
|
|
|
|
|
|
| 52 |
|
| 53 |
+
# Fallback
|
| 54 |
+
return datetime.utcnow().replace(tzinfo=pytz.utc)
|
| 55 |
|
| 56 |
# Session setup
|
| 57 |
if "history" not in st.session_state:
|