Skip to content

Commit

Permalink
fix: invalid timezone during set dateTime
Browse files Browse the repository at this point in the history
  • Loading branch information
Decodetalkers authored and deepin-bot[bot] committed Jan 16, 2024
1 parent f6cfe0f commit 7e581d7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion timedate1/manager_ifc.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ func (m *Manager) Reset() *dbus.Error {
//
// The time may be specified in the format '2015' '1' '1' '18' '18' '18' '8'.
func (m *Manager) SetDate(year, month, day, hour, min, sec, nsec int32) *dbus.Error {
loc, err := time.LoadLocation(m.Timezone)
timeZone := m.Timezone
if strv.Strv(customTimeZoneList).Contains(m.Timezone) {
timeZone = "Asia/Shanghai"
}
loc, err := time.LoadLocation(timeZone)
if err != nil {
logger.Debugf("Load location '%s' failed: %v", m.Timezone, err)
return dbusutil.ToError(err)
Expand Down

0 comments on commit 7e581d7

Please sign in to comment.