unified time strings

This commit is contained in:
Martin Wagner 2022-05-27 22:13:04 +02:00
parent 666fe08208
commit 6acef07ccc

View File

@ -516,8 +516,8 @@ class LastModified():
self._date=date self._date=date
def __str__(self): def __str__(self):
time=datetime.datetime.strptime(self._date, "%Y-%m-%dT%H:%M:%SZ") time=datetime.datetime.strptime(self._date, "%Y-%m-%dT%H:%M:%SZ").replace(tzinfo=datetime.timezone.utc)
return time.strftime("%a %d %B %Y, %H%M UTC") return time.astimezone(tz=None).strftime("%a %d %B %Y, %H%M")
def raw(self): def raw(self):
return self._date return self._date
@ -1274,7 +1274,7 @@ class ServerStats(Gtk.Dialog):
stats["protocol"]=str(client.mpd_version) stats["protocol"]=str(client.mpd_version)
for key in ("uptime","playtime","db_playtime"): for key in ("uptime","playtime","db_playtime"):
stats[key]=str(Duration(stats[key])) stats[key]=str(Duration(stats[key]))
stats["db_update"]=str(datetime.datetime.fromtimestamp(int(stats["db_update"]))).replace(":", "") stats["db_update"]=datetime.datetime.fromtimestamp(int(stats["db_update"])).strftime("%a %d %B %Y, %H%M")
for i, key in enumerate(("protocol","uptime","playtime","db_update","db_playtime","artists","albums","songs")): for i, key in enumerate(("protocol","uptime","playtime","db_update","db_playtime","artists","albums","songs")):
grid.attach(Gtk.Label(label=display_str[key], use_markup=True, xalign=1), 0, i, 1, 1) grid.attach(Gtk.Label(label=display_str[key], use_markup=True, xalign=1), 0, i, 1, 1)