Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] time shown differs from system #626

Closed
tan-wei-xin-alez opened this issue Sep 22, 2023 · 8 comments
Closed

[BUG] time shown differs from system #626

tan-wei-xin-alez opened this issue Sep 22, 2023 · 8 comments
Assignees
Labels
bug Something isn't working

Comments

@tan-wei-xin-alez
Copy link

Read the README.md and search for similar issues before posting a bug report!

Any bug that can be solved by just reading the prerequisites section of the README will likely be ignored.

Describe the bug

As mentioned here, for some reason, the time btop is showing differs from my system time

To Reproduce

Simply run btop after installing it and make sure menu → general → Clock format is set to %X

Expected behavior

Time shown by btop and system time should be the same

Screenshots

image

Info (please complete the following information):

  • btop++ version:
➜  ~ btop --version
btop version: 1.2.13
  • Binary: Installed via package manager (I'm using the linuxbrew formulae)
  • (If compiled) Compiler and version: N/A
  • Architecture, Platform, (Linux) Kernel, OS release version and Terminal used:
➜  ~ fastfetch
              .',:clooo:  .:looooo:.           ------------------------
           .;looooooooc  .oooooooooo'          OS: Ubuntu 20.04 x86_64
        .;looooool:,''.  :ooooooooooc          Host: Precision 5570
       ;looool;.         'oooooooooo,          Kernel: 5.15.0-78-generic
      ;clool'             .cooooooc.  ,,       Uptime: 35 days, 20 hours, 48 mins
         ...                ......  .:oo,      Packages: 2235 (dpkg), 12 (snap), 101 (brew)
  .;clol:,.                        .loooo'     Shell: zsh 5.9
 :ooooooooo,                        'ooool     Display (LG HDR 4K): 3840x2160 @ 60Hz *
'ooooooooooo.                        loooo.    Display (SHP1515): 1920x1200 @ 60Hz
'ooooooooool                         coooo.    Display (SyncMaster): 1920x1200 @ 60Hz
 ,loooooooc.                        .loooo.    DE: Gnome 3.36.9
   .,;;;'.                          ;ooooc     WM: Mutter (X11)
       ...                         ,ooool.     WM Theme: Yaru
    .cooooc.              ..',,'.  .cooo.      Theme: Yaru [GTK3]
      ;ooooo:.           ;oooooooc.  :l.       Icons: Yaru [GTK3]
       .coooooc,..      coooooooooo.           Cursor: DMZ-White
         .:ooooooolc:. .ooooooooooo'           Terminal: tmux: server
           .':loooooo;  ,oooooooooc            CPU: 12th Gen Intel(R) Core(TM) i9-12900H (20) @ 4.9 GHz
               ..';::c'  .;loooo:'             Memory: 26.71 GiB / 62.47 GiB (43%)
                             .                 Disk (/): 88.42 GiB / 929.04 GiB (10%) - ext4
                                               Battery: 100% [Full]
                                               Locale: en_US.UTF-8
  • Font used:
➜  ~ gsettings get org.gnome.desktop.interface monospace-font-name
'Ubuntu Mono 13'

Additional context

contents of ~/.config/btop/btop.log

(try running btop with --debug flag if btop.log is empty)

2023/09/22 (17:36:08) | ===> btop++ v.1.2.13
2023/09/22 (17:36:08) | DEBUG: Starting in DEBUG mode!
2023/09/22 (17:36:08) | INFO: Logger set to DEBUG
2023/09/22 (17:36:08) | DEBUG: Using locale en_US.UTF-8
2023/09/22 (17:36:08) | INFO: Running on /dev/pts/7

GDB Backtrace

If btop++ is crashing at start the following steps could be helpful:

(Extra helpful if compiled with make OPTFLAGS="-O0 -g")

  1. run (linux): gdb btop (macos): lldb btop

  2. r to run, wait for crash and press enter if prompted, CTRL+L to clear screen if needed.

  3. (gdb): thread apply all bt (lldb): bt all to get backtrace for all threads

  4. Copy and paste the backtrace here: N/A

@tan-wei-xin-alez tan-wei-xin-alez added the bug Something isn't working label Sep 22, 2023
@tan-wei-xin-alez tan-wei-xin-alez changed the title [BUG] [BUG] time shown differs from system Sep 22, 2023
@aristocratos
Copy link
Owner

@tan-wei-xin-alez
What time do you get if you just run date in the terminal?

This should be dependent on which timezone your terminal thinks you're in, btop can change your locale if your native locale doesn't have a UTF-8 version generated, but that wouldn't change your current time zone.

@tan-wei-xin-alez
Copy link
Author

What time do you get if you just run date in the terminal?

@aristocratos That was actually one of the first things I checked

image

Do my locale settings matter?

➜  ~ locale
LANG=en_US.UTF-8
LANGUAGE=en_US:
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=en_US.UTF-8

@tan-wei-xin-alez
Copy link
Author

tan-wei-xin-alez commented Sep 22, 2023

Oh I just realized btop is showing Universal time instead of Local time for some reason, would you happen to know why? @aristocratos

➜  ~ timedatectl
               Local time: Fri 2023-09-22 22:46:51 CEST
           Universal time: Fri 2023-09-22 20:46:51 UTC
                 RTC time: Fri 2023-09-22 20:46:51
                Time zone: Europe/Berlin (CEST, +0200)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no

@aristocratos
Copy link
Owner

@tan-wei-xin-alez
The %X option is locale dependent.
You can enter %X %Z which should show the time zone.
The time is generated using strftime for reference: https://cplusplus.com/reference/ctime/strftime/

But you could try running sudo locale-gen and see if that fixes it.

@tan-wei-xin-alez
Copy link
Author

tan-wei-xin-alez commented Sep 22, 2023

cool, %X %Z indicated that btop was using the UTC timezone and some searching about strftime yielded the appropriate environmental variable that had to be set

so I got it to use my timezone by running TZ='CET' btop (CEST is not a valid value for TZ), but I don't think this is written anywhere in the README so it might be worth adding that

Might even be worthwhile to add it as something that can be set in menu → general as well as configurable in btop.conf like below

#* Timezone used by clock at top of screen, defaults to UTC if string is empty
clock_timezone = "CET"

@aristocratos
Copy link
Owner

so I got it to use my timezone by running TZ='CEST' btop, but I don't think this is written anywhere in the README so it might be worth adding that

I'm fairly certain this is an issue related to configuration on your system. Considering this is the first report I've ever gotten of this particular problem.

My timezone (also CEST) gets picked up without problem, the TZ variable is empty on my system.
I'm also using en_US.UTF-8 as locale and are running Ubuntu.
So there must be some configuration related to time/time zone config that hasn't been properly set on your system for some reason.

@tan-wei-xin-alez
Copy link
Author

ok, I figured out exactly why, it's because I used brew to install btop instead of snap so my binary is located under a different user

➜  ~ whence btop
/home/linuxbrew/.linuxbrew/bin/btop

and I'm guessing, the linuxbrew user is set to the UTC timezone

Sorry for bothering and thanks for the help @aristocratos !

@aristocratos
Copy link
Owner

@tan-wei-xin-alez

ok, I figured out exactly why, it's because I used brew to install btop instead of snap so my binary is located under a different user

Good find!

Sorry for bothering and thanks for the help @aristocratos !

No problem :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants