Repository: syncthing/syncthing (language: go)

Issue:
ursrv: unrealistic uptime data, likely due to unset RTC (1970-01-01)
The 100% percentile currently lists 51.4 years as the uptime, which is obviously impossible. I guess that someone must have changed their OS date to the future or something…

![image](https://user-images.githubusercontent.com/5626656/118817372-1b9e0480-b8ee-11eb-9ba6-2ed50d7d8389.png)


Discussion / hints:
Sure, who cares? It's not that some decisions are based on these numbers.

It's more like a relay running on RPi on startup, because it has no RTC, the relay starts up before the time gets set by ntp/chrony.
We could still filter any uptime which predates the project start :wink:
Or not...
I'm going to close this.
It's cosmetic, a number that doesn't have much meaning. I am not bothered.
This data is occasionally referred to in other places (e.g. see https://news.ycombinator.com/item?id=13856552). Wouldn't it be beneficial to make sure that all the numbers presented there are actually real/credible?

> It's cosmetic, a number that doesn't have much meaning. I am not bothered.

Yeah, but then the counterargument is - why collect/present it at all, if there is no meaning to it?
To me the main point here is this is cosmetical, low(est) importance, no need for discussion and low effort to fix. Basically the kind of thing that sure, fix it if it annoys you, but having an issue lie around and involving (by now 4) people in it is a waste of time. A closed bug doesn't necessarily mean "everything needs to stay as is, don't touch it", it might just mean "this is not worth tracking".
Dammit, you guys. "Who cares" is not a good response to a filed issue; clearly at least @tomasz1986 did because he filed. "We don't track cosmetic issues" is clearly not true in general, and not even for the usage reporting in particular because #7661 where we obviously did care -- it's pretty much *the same* as this issue. The cost of a cosmetic-issue issue in the tracker is essentially zero, so if we don't care about then just leave it be instead of arguing about it, until someone comes around to fix it. It might even be a `good first issue` starting point for someone.

Fix patch:
diff --git a/lib/ur/usage_report.go b/lib/ur/usage_report.go
index 9b5cccddf27..ce6984a4c07 100644
--- a/lib/ur/usage_report.go
+++ b/lib/ur/usage_report.go
@@ -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())
 }
 


Test patch: