mirror of
https://github.com/octoleo/syncthing.git
synced 2025-01-03 07:12:27 +00:00
Currently, because of devices with unset RTC clock, the 100% percentile for Uptime on [1] is calculated since the Unix epoch which is useless as far as usage statistics are concerned. Thus, if the Syncthing start time is set to a past date, assume that the clock is wrong and do not even try to report the uptime. [1] https://data.syncthing.net Signed-off-by: Tomasz Wilczyński <twilczynski@naver.com> Co-authored-by: Jakob Borg <jakob@kastelo.net>
This commit is contained in:
parent
6b6b2c6194
commit
f42f041f53
@ -328,6 +328,11 @@ func (s *Service) reportData(ctx context.Context, urVersion int, preview bool) (
|
||||
}
|
||||
|
||||
func (*Service) UptimeS() int {
|
||||
// Handle nonexistent or wildly incorrect system clock.
|
||||
// This code was written in 2023, it can't run in the past.
|
||||
if StartTime.Year() < 2023 {
|
||||
return 0
|
||||
}
|
||||
return int(time.Since(StartTime).Seconds())
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user