Skip to content

TIME+ in Web UI Shows Incorrect Large Values #3401

@xBoBx78

Description

@xBoBx78

Check the bug
This is technically a duplicate of bug #2902, but the issue is still present in latest version (for anybody in a negative offset time zone).

Describe the bug
The Glances Web UI displays incorrect TIME+ values for processes. Instead of showing the actual CPU time (e.g., 04:09:06), the Web UI shows extremely large durations such as:

8740:09:06

This corresponds to ~364 days, even though the backend JSON reports only a few hours of CPU time. The CLI displays the correct value; only the Web UI is affected.

Cause of the Error
The Web UI’s timedelta function mixes UTC and local‑time date arithmetic. Specifically, it uses:

new Date(d.getFullYear(), 0, 0)

This constructor always interprets the date in local time, while the rest of the function uses UTC (getUTCHours(), getUTCMinutes(), etc.).

In any non‑UTC timezone, this mismatch causes:

  • the “start of year” anchor to shift by the local timezone offset
  • the computed day‑of‑year (doy) to become 0 instead of 1
  • (doy - 1) * 24 to produce a negative hour offset
  • the formatter to convert that negative duration back into a Date, which lands in the previous year
  • the next doy calculation to return 364, producing ~8736 hours

This is why small CPU times (a few hours) appear as ~364 days in the Web UI.

One‑Line Fix
Replace the local‑time anchor with a UTC‑based anchor:

new Date(Date.UTC(d.getUTCFullYear(), 0, 1))

To Reproduce

Start Glances with the following options '-w'
Open web UI and look at process list

Expected behavior
Show the correct TIME+ values in the web UI

Screenshots
If applicable, add screenshots to help explain your problem.

Image

Environment (please complete the following information)

  • Operating System (lsb_release -a or OS name/version): To be completed with result of: lsb_release -a
    No LSB modules are available.
    Distributor ID: Ubuntu
    Description: Ubuntu 25.10
    Release: 25.10
    Codename: questing

  • Glances & psutil versions: To be completed with result of: glances -V
    Glances version: 4.4.2_dev1
    Glances API version: 4
    PsUtil version: 7.2.1
    Log file: /tmp/glances-root.log

  • How do you install Glances (Pypi package, script, package manager, source): To be completed
    (via docker) pip install glances[all] nvidia-ml-py3

  • Glances test: To be completed with result of: glances --issue
    glances --issue
    ===============================================================================
    Glances 4.4.2_dev1 (/app/glances/init.py)
    Python 3.12.3 (/venv/bin/python3)
    PsUtil 7.2.1 (/venv/lib/python3.12/site-packages/psutil/init.py)
    ===============================================================================
    alert [OK] 0.00002s
    []
    amps [OK] 0.00010s key=name
    [{'count': 0,
    'countmax': None,
    'countmin': 1.0,
    'key': 'name',
    'name': 'Dropbox',
    'refresh': 3.0,
    'regex': True,
    'result': None,
    'timer': 2.1351966857910156}, ...]
    cloud [NA]
    connections [NA]
    containers [OK] 0.01105s key=name
    [{'command': '/init',
    'cpu_percent': 1.8790195263813876,
    'created': '2024-12-05T00:29:37.685280871Z',
    'engine': 'docker',
    'id': '4bd47d2e4657e95c49232b69ccba540020889fd0ec519fc42678d26426aeb4c4',
    'image': ('lscr.io/linuxserver/deluge:latest',),
    'io_rx': None,
    'io_wx': None,
    'key': 'name',
    'memory_inactive_file': 33267576832,
    'memory_limit': 130091741184,
    'memory_percent': None,
    'memory_usage': 81789132800,
    'name': 'deluge',
    'network_rx': None,
    'network_tx': None,
    'ports': '',
    'status': 'running',
    'uptime': 'yesterday'}, ...]
    core [OK] 0.00043s
    {'log': 24, 'phys': 12}
    cpu [OK] 0.00023s
    {'cpucore': 24,
    'ctx_switches': 0,
    'ctx_switches_gauge': 26168247151,
    'ctx_switches_rate_per_sec': 0,
    'guest': 0.0,
    'idle': 99.6,
    'interrupts': 0,
    'interrupts_gauge': 20984075302,
    'interrupts_rate_per_sec': 0,
    'iowait': 0.0,
    'irq': 0.0,
    'nice': 0.0,
    'soft_interrupts': 0,
    'soft_interrupts_gauge': 12936512578,
    'soft_interrupts_rate_per_sec': 0,
    'steal': 0.0,
    'syscalls': 0,
    'syscalls_gauge': 0,
    'syscalls_rate_per_sec': 0,
    'system': 0.1,
    'time_since_update': 2.0141777992248535,
    'total': 0.7,
    'user': 0.2}
    diskio [OK] 0.00054s key=disk_name
    [{'disk_name': 'md1',
    'key': 'disk_name',
    'read_bytes': 0,
    'read_bytes_gauge': 206447404032,
    'read_bytes_rate_per_sec': 0,
    'read_count': 0,
    'read_count_gauge': 1523432,
    'read_count_rate_per_sec': 0,
    'read_latency': 0,
    'read_time': 0,
    'read_time_gauge': 3417795,
    'read_time_rate_per_sec': 0,
    'time_since_update': 2.0153005123138428,
    'write_bytes': 0,
    'write_bytes_gauge': 171405758464,
    'write_bytes_rate_per_sec': 0,
    'write_count': 0,
    'write_count_gauge': 19346916,
    'write_count_rate_per_sec': 0,
    'write_latency': 0,
    'write_time': 0,
    'write_time_gauge': 13626183,
    'write_time_rate_per_sec': 0}, ...]
    folders [OK] 0.00002s
    []
    fs [OK] 0.07839s key=mnt_point
    [{'device_name': '/dev/mapper/ubuntu--vg-ubuntu--lv',
    'free': 126214942720,
    'fs_type': 'ext4',
    'key': 'mnt_point',
    'mnt_point': '/rootfs',
    'options': 'ro,relatime',
    'percent': 46.3,
    'size': 247677284352,
    'used': 108806451200}, ...]
    gpu [OK] 0.00275s key=gpu_id
    [{'fan_speed': 0,
    'gpu_id': 'nvidia0',
    'key': 'gpu_id',
    'mem': 98.45658280410356,
    'name': 'NVIDIA GeForce RTX 3090 Ti',
    'proc': 0,
    'temperature': 45}, ...]
    help [OK] 0.00000s
    None
    ip [OK] 0.00055s
    {'address': '', 'mask': '', 'mask_cidr': '***'}
    irq [NA]
    load [OK] 0.00003s
    {'cpucore': 24, 'min1': 0.38623046875, 'min15': 0.44970703125, 'min5': 0.50146484375}
    mem [OK] 0.00009s
    {'active': 56557821952,
    'available': 116901158912,
    'buffers': 1300746240,
    'cached': 116308054016,
    'free': 809852928,
    'inactive': 67159433216,
    'percent': 10.1,
    'shared': 276881408,
    'total': 130091741184,
    'used': 13190582272}
    memswap [OK] 0.00009s
    {'free': 4299350016,
    'percent': 49.9,
    'sin': 6823096320,
    'sout': 14771068928,
    'time_since_update': 2.2184982299804688,
    'total': 8589930496,
    'used': 4290580480}
    network [OK] 0.00052s
    []
    now [OK] 0.00003s
    {'custom': '2026-01-10 23:25:01 PST', 'iso': '2026-01-10T23:25:01-08:00'}
    percpu [OK] 0.00040s key=cpu_number
    [{'cpu_number': 0,
    'dpc': None,
    'guest': 0.0,
    'guest_nice': 0.0,
    'idle': 99.1,
    'interrupt': None,
    'iowait': 0.0,
    'irq': 0.0,
    'key': 'cpu_number',
    'nice': 0.0,
    'softirq': 0.0,
    'steal': 0.0,
    'system': 0.5,
    'total': 0.9,
    'user': 0.5}, ...]
    ports [OK] 0.00000s
    []
    processcount [OK] 0.03316s
    {'pid_max': 0, 'running': 1, 'sleeping': 309, 'thread': 1243, 'total': 524}
    processlist [OK] 0.00014s
    []
    programlist [OK] 0.00081s
    []
    psutilversion [OK] 0.00002s
    '7.2.1'
    quicklook [OK] 0.00019s
    {'cpu': 0.7,
    'cpu_hz': 5662016000.000002,
    'cpu_hz_current': 3721405416.666666,
    'cpu_log_core': 24,
    'cpu_name': 'AMD Ryzen 9 9900X 12-Core Processor',
    'cpu_phys_core': 12,
    'load': 1.9,
    'mem': 10.1,
    'percpu': [{...}, {...}, {...}, {...}, {...}, {...}, {...}, {...}, {...}, {...}, {...}, {...}, {...}, {...}, {...},
    {...}, {...}, {...}, {...}, {...}, {...}, {...}, {...}, {...}],
    'swap': 49.9}
    raid [NA]
    sensors [OK] 0.00000s key=label
    [{'critical': None,
    'key': 'label',
    'label': 'Tccd1',
    'type': 'temperature_core',
    'unit': 'C',
    'value': 40,
    'warning': None}, ...]
    smart [NA]
    system [OK] 0.00000s
    {'hostname': 'blackhole',
    'hr_name': 'Ubuntu 25.10 64bit / Linux 6.17.0-7-generic',
    'linux_distro': 'Ubuntu 25.10',
    'os_name': 'Linux',
    'os_version': '6.17.0-7-generic',
    'platform': '64bit'}
    uptime [OK] 0.00007s
    {'seconds': 2709773}
    version [OK] 0.00001s
    '4.4.2_dev1'
    vms [NA]
    wifi [OK] 0.00004s
    []
    ===============================================================================
    Total time to update all stats: 0.13109s
    ===============================================================================

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions