uptime counts time spend in suspend

Bug #647472 reported by Michał Gołębiowski-Owczarek
12
This bug affects 3 people
Affects Status Importance Assigned to Milestone
procps (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Binary package hint: procps

According to man, amongst other things uptime shows "how long the system has been running". This is not true in the case of suspending the computer, as uptime counts the time spend in suspend as uptime time. In this way one can turn on a computer, put it to sleep for a week and then go back from suspend and uptime will show them the whole 7 days of uptime.

ProblemType: Bug
DistroRelease: Ubuntu 10.04
Package: procps 1:3.2.8-1ubuntu4
ProcVersionSignature: Ubuntu 2.6.32-24.43-generic 2.6.32.15+drm33.5
Uname: Linux 2.6.32-24-generic x86_64
NonfreeKernelModules: wl
Architecture: amd64
Date: Sat Sep 25 14:20:54 2010
InstallationMedia: Ubuntu 9.10 "Karmic Koala" - Release amd64 (20091027)
SourcePackage: procps

Revision history for this message
Michał Gołębiowski-Owczarek (mgol) wrote :
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in procps (Ubuntu):
status: New → Confirmed
Revision history for this message
rsaxvc (rsaxvc-5) wrote :

Should we just update the documentation to reflect the program? Maybe something like "How long since the system booted" ?

Revision history for this message
Michal Linuxak (opruz) wrote :

Note: bug is present in Ubuntu 14.04

Revision history for this message
Stephan (world-wide) wrote :

This is no specific issue of procps, it just returns the value from the kernel. The kernel documents (in the source) that the value includes the time spent in suspend.

/proc/uptime gets the value from here:

https://elixir.bootlin.com/linux/v4.20.3/source/include/linux/timekeeping.h#L93

/**
 * ktime_get_boottime - Returns monotonic time since boot in ktime_t format
 *
 * This is similar to CLOCK_MONTONIC/ktime_get, but also includes the
 * time spent in suspend.
 */
static inline ktime_t ktime_get_boottime(void)
{
 return ktime_get_with_offset(TK_OFFS_BOOT);
}

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.