[FEAT] datetime module alternative for systems without a Real Time Clock (RTC)
Before requesting a new feature
- A lot of features are not enabled by default. Please try
fastfetch --list-modulesandfastfetch -c all.jsoncto see if it has been supported - Fastfetch supports
Commandmodule, which can be used to grab output from a custom shell script. Please check if it fits your needs
// ~/.config/fastfetch/fastfetch.jsonc
{
"modules": [
{
"type": "command",
"text": "/path/to/your/script",
"key": "Feature Title"
}
]
}
Wanted features:
I'm running fastfetch (2.11.1 arm) on a FriendlyELEC NanoPi NEO. The 'datetime' module is returning a date & time from 1970. This may be due to the NanoPi NEO not having a hardware based Real Time Clock (RTC). Instead it uses the 'fake-hwclock' process.
Package: fake-hwclock
Status: install ok installed
Priority: optional
Section: admin
Installed-Size: 32
Maintainer: Steve McIntyre <[email protected]>
Architecture: all
Version: 0.12+nmu1
Suggests: cron | cron-daemon, ntp
Conffiles:
/etc/cron.hourly/fake-hwclock f390eb8cf4180ac2f1518027707d6b27
/etc/default/fake-hwclock a8ec74297d61f68ac54e933c8f98d335
/etc/init.d/fake-hwclock 6ed42ea93d6c122ced6449157c977674
Description: Save/restore system clock on machines without working RTC hardware
Some machines don't have a working realtime clock (RTC) unit, or no
driver for the hardware that does exist. fake-hwclock is a simple set
of scripts to save the kernel's current clock periodically (including
at shutdown) and restore it at boot so that the system clock keeps at
least close to realtime. This will stop some of the problems that may
be caused by a system believing it has travelled in time back to
1970, such as needing to perform filesystem checks at every boot.
.
On top of this, use of NTP is still recommended to deal with the fake
clock "drifting" while the hardware is halted or rebooting.`
_,met$$$$$gg. root@mhj-neo
,g$$$$$$$$$$$$$$$P.
,g$$P" """Y$$.". Date & Time: 1970-01-19 07:51:57
,$$P' `$$$.
',$$P ,ggs. `$$b: Host: FriendlyARM NanoPi NEO
`d$$' ,$P"' . $$$ Uptime: 1 day, 9 hours, 24 mins
$$P d$' , $$$P Startup : Startup finished in 6.818s (kernel) + 21.531s (userspace) = 28.350s graphical.target reached after 20.219s in userspace.
$$: $. - ,d$$' Processes: 180
$$; Y$b._ _,d$P' CPU: ARMv7 rev 5 (v7l) (4) @ 1.30 GHz
Y$$. `.`"Y$$$$P"' CPU Usage: 0%
`$$b "-.__ OS: Debian GNU/Linux bookworm 12.5 armv7l
`Y$$ Kernel: 6.6.16-current-sunxi
`Y$$. Memory: 127.08 MiB / 490.52 MiB (26%)
`$$b. Physical Disk (mmcblk0): 29.81 GiB [SSD, Fixed]
`Y$$b. Disk (/): 9.66 GiB / 28.43 GiB (34%) - ext4
`"Y$b._ Disk IO (mmcblk0): 60.00 KiB/s (R) - 0 B/s (W)
`""" Swap: 768.00 KiB / 32.00 MiB (2%)
Shell: bash 5.2.15
Packages: 1009 (dpkg)
Cursor: Adwaita
Terminal: dropbear
Terminal Size: 348 columns x 83 rows (3828px x 2075px)
Terminal Theme: #55FF55 (FG) - #000000 (BG) [Dark]
Local IP (eth0): 10.1.10.10/24 *
Public IP: xx.xx.xx.xx (a galaxy far far away, US)
Network IO (eth0): 4.87 KiB/s (IN) - 7.71 KiB/s (OUT) *
Locale: C.UTF-8
Version: fastfetch 2.11.1 (arm)
Motivation:
Not all systems have a hardware based RTC. If possible I would ask that you consider the date & time be taken from another system resource or an external NTP source.
Thank you for your consideration!
Sorry, forgot to include my current fastfetch configuration.
{
"modules": [
"title",
"break",
"datetime",
"break",
"host",
"uptime",
{
"type": "command",
"text": "systemd-analyze time | tr -d '\n' ; echo",
"key": "Startup ",
},
"processes",
"cpu",
"cpuusage",
"os",
"kernel",
"memory",
"physicaldisk",
"disk",
"diskio",
"swap",
"shell",
"packages",
"cursor",
"terminal",
"terminalsize",
"terminaltheme",
"localip",
"publicip",
"netio",
"locale",
"version",
]
}
/* =============================================================================
FILE: neo-fastfetch.jsonc
LOCATION: [mhj-neo] /usr/local/bin/
CLI USAGE: fastfetch -c /usr/local/bin/neo-fastfetch.jsonc
ALIAS: ff & ffa
OWNER/GROUP: root:root
PERMISSIONS: 0644 -rw-r--r--
SUDO RQD: NO
DESCRIPTION: This fastfetch configuration file supports the following modules;
title Print title; your username, hostname
break Print a empty line
datetime Print current date and time
break Print a empty line
host Print product name of your computer
uptime Print how long system has been running
startup Customized 'systemd-analyze time'
processes Count running processes
cpu Print CPU name, frequency, etc
cpuusage Print CPU usage
os Print operating system name and version
kernel Print system kernel version
memory Print system memory usage info
physicaldisk Print physical disk information
disk Print partitions, space usage, type, etc
diskio Print physical disk I/O throughput
swap Print swap (paging file) space usage
shell Print current shell name and version
packages List installed package managers and count of
installed packages
cursor system cursor ID & size
terminal Print current terminal name and version
terminalsize Print current terminal size
terminaltheme Print current terminal theme (foreground and
background colors)
localip List local IP addresses (IPv4 or IPv6),
MAC addresses, etc
publicip Print your public IP address, etc
netio Print network I/O throughput
locale Print system locale name
version Print Fastfetch version
DEPENDENCIES: + coreutils 9.1-1
+ dpkg 1.21.22
+ fastfetch 2.11.1 (arm)
+ systemd 252.22-1~deb12u1
PKG: coreutils dpkg fastfetch systemd
PKG SOURCE: + coreutils echo, tr,
+ systemd systemd-analyze,
PKG OPTIONS: + fastfetch
-c Use the specified config file or preset.
Must contain full path to .jsonc file.
+ systemd-analyze
time prints the time spent in the kernel before
userspace has been reached, the time spent
in the initial RAM disk (initrd) before
normal system userspace has been reached,
and the time normal system userspace took
to initialize
+ tr
-d 'SET' delete characters in SET, do not translate
'\n' SET = new line
ALIAS: # ff fastfetch & cpufetch
alias ff='cl ; echo ; fastfetch -c /usr/local/bin/neo-fastfetch.jsonc ; cpufetch ; echo'
# ffa fastfetch, cpufetch, mem, and get-ip
alias ffa='cl ; echo ; fastfetch -c /usr/local/bin/neo-fastfetch.jsonc ; cpufetch ; free -th --mega ; bash /usr/local/bin/get-ip ; echo'
NOTES: +
TODO: +
BUGS: !
HISTORY: 3.0.0 - Minor Thursday, May 09, 2024 05:00 PM PDT
+ renamed to neo-fastfetch.jsonc to remove version info OK
- deprecated use of nerdfonts OK
+ modified alias ff to include cpufetch OK
+ added alias ffa with fastfetch, cpufetch, mem, and get-ip
bash script OK
+ updated documentation OK
+ tested OK
2.0.0 - Major Sunday, May 05, 2024 10:00 AM PDT
+ total rewrite based on '-c all.jsonc' output OK
- deprecated nerdfont icons OK
+ based on mhj-SEi12 ~/.config/fastfetch/mhj-0_2_0.jsonc OK
+ tested OK
+ updated documentation OK
1.0.0 - Minor Friday, May 03, 2024 03:00 PM PDT
+ modified systemd-analyze startup 'command' syntax to have
complete output on single line OK
+ tested OK
+ updated documentation OK
0.1.0 - Fix Friday, May 03, 2024 01:00 PM PDT
+ fixed systemd-analyze startup 'command' syntax OK
+ tested OK
+ updated documentation OK
0.0.3 - Major Friday, May 03, 2024 12:00 PM PDT
+ rewrite / reorganization of modules OK
+ added startup 'command' using systemd-analyze OK
+ tested OK
+ updated documentation OK
0.0.2 - Major Friday, May 03, 2024 11:00 AM PDT
+ using presets/examples/10.jsonc as a rough template OK
+ tested OK
+ updated documentation OK
0.0.1 Friday, May 03, 2024 10:00 AM PDT
VERSION: 3.0.0 - Stable
CREATED: Friday, May 03, 2024 10:00 AM PDT
REVISED: Thursday, May 09, 2024 05:00 PM PDT
LAST TESTED: Thursday, May 09, 2024 05:00 PM PDT
TEMPLATE VER: 1r-bookworm
LINUX DISTRO: Debian GNU/Linux 12.5 (bookworm) armv7l
SYSTEM INFO: mhj-neo
AUTHOR: MHJessen (mhj)
COMPANY: MHJessen Applied Solutions
LICENSE: MIT (or beer,.... scotch works too.... and whiskey, good whiskey)
============================================================================= */
sntp pool.ntp.org?
I think this is a rare case. Using Command module should be enough.
sntp pool.ntp.org?I think this is a rare case. Using
Commandmodule should be enough.
OK, sounds good. I went with a simple 'command' module using the GNU coreutils date command with a custom strftime string. The result;
_,met$$$$$gg. root@mhj-neo
,g$$$$$$$$$$$$$$$P.
,g$$P" """Y$$.". Date & Time: Friday, May 10, 2024 - 09:11 AM PDT
,$$P' `$$$.
',$$P ,ggs. `$$b: Host: FriendlyARM NanoPi NEO
`d$$' ,$P"' . $$$ Uptime: 2 days, 11 mins
$$P d$' , $$$P Startup : Startup finished in 6.818s (kernel) + 21.531s (userspace) = 28.350s graphical.target reached after 20.219s in userspace.
$$: $. - ,d$$' Processes: 182
$$; Y$b._ _,d$P' CPU: ARMv7 rev 5 (v7l) (4) @ 1.30 GHz
Y$$. `.`"Y$$$$P"' CPU Usage: 0%
`$$b "-.__ OS: Debian GNU/Linux bookworm 12.5 armv7l
`Y$$ Kernel: 6.6.16-current-sunxi
`Y$$. Memory: 127.22 MiB / 490.52 MiB (26%)
`$$b. Physical Disk (mmcblk0): 29.81 GiB [SSD, Fixed]
`Y$$b. Disk (/): 9.62 GiB / 28.43 GiB (34%) - ext4
`"Y$b._ Disk IO (mmcblk0): 452.00 KiB/s (R) - 0 B/s (W)
`""" Swap: 768.00 KiB / 32.00 MiB (2%)
Shell: bash 5.2.15
Packages: 1009 (dpkg)
Cursor: Adwaita
Terminal: dropbear
Terminal Size: 348 columns x 83 rows (3828px x 2075px)
Terminal Theme: #55FF55 (FG) - #000000 (BG) [Dark]
Local IP (eth0): 10.1.10.10/24 *
Public IP: xx.xx.xx.xx (First City, Qo'noS)
Network IO (eth0): 4.94 KiB/s (IN) - 8.09 KiB/s (OUT) *
Locale: C.UTF-8
Version: fastfetch 2.11.1 (arm)
The finished / tested fastfetch configuration file in case anyone is interested;
{
"modules": [
"title",
"break",
{
"type": "command",
"text": "date '+%A, %B %d, %Y - %I:%M %p %Z' ; echo",
"key": "Date & Time",
},
"break",
"host",
"uptime",
{
"type": "command",
"text": "systemd-analyze time | tr -d '\n' ; echo",
"key": "Startup ",
},
"processes",
"cpu",
"cpuusage",
"os",
"kernel",
"memory",
"physicaldisk",
"disk",
"diskio",
"swap",
"shell",
"packages",
"cursor",
"terminal",
"terminalsize",
"terminaltheme",
"localip",
"publicip",
"netio",
"locale",
"version",
]
}
/* =============================================================================
FILE: neo-fastfetch.jsonc
LOCATION: [neo-fastfetch] /usr/local/bin/
CLI USAGE: fastfetch -c /usr/local/bin/neo-fastfetch.jsonc
ALIAS: ff & ffa
OWNER/GROUP: root:root
PERMISSIONS: 0644 -rw-r--r--
SUDO RQD: NO
DESCRIPTION: This fastfetch configuration file supports the following modules;
title Print title; your username, hostname
break Print a empty line
Date & Time Customized current date & time using 'date'
break Print a empty line
host Print product name of your computer
uptime Print how long system has been running
Startup Customized 'systemd-analyze time'
processes Count running processes
cpu Print CPU name, frequency, etc
cpuusage Print CPU usage
os Print operating system name and version
kernel Print system kernel version
memory Print system memory usage info
physicaldisk Print physical disk information
disk Print partitions, space usage, type, etc
diskio Print physical disk I/O throughput
swap Print swap (paging file) space usage
shell Print current shell name and version
packages List installed package managers and count of
installed packages
cursor system cursor ID & size
terminal Print current terminal name and version
terminalsize Print current terminal size
terminaltheme Print current terminal theme (foreground and
background colors)
localip List local IP addresses (IPv4 or IPv6),
MAC addresses, etc
publicip Print your public IP address, etc
netio Print network I/O throughput
locale Print system locale name
version Print Fastfetch version
DEPENDENCIES: + coreutils 9.1-1
+ dpkg 1.21.22
+ fastfetch 2.11.1
+ systemd 252.22-1~deb12u1
PKG: coreutils dpkg fastfetch systemd
PKG SOURCE: + coreutils date, echo, tr,
+ systemd systemd-analyze,
PKG OPTIONS: + date
%A full weekday name, current locale
%B full month name, current locale
%d day of the month, decimal (range 01 - 31)
%Y year, decimal, including the century
%I hour, decimal, 12-hour clock (range 01 - 12)
%M minute, decimal (range 00 - 59)
%p "AM" or "PM"
%Z timezone abbreviation
+ fastfetch
-c Use the specified config file or preset.
Must contain full path to .jsonc file.
+ systemd-analyze
time prints the time spent in the kernel before
userspace has been reached, the time spent
in the initial RAM disk (initrd) before
normal system userspace has been reached,
and the time normal system userspace took
to initialize
+ tr
-d 'SET' delete characters in SET, do not translate
'\n' SET = new line
ALIAS: # ff fastfetch & cpufetch
alias ff='cl ; echo ; fastfetch -c /usr/local/bin/neo-fastfetch.jsonc ; cpufetch ; echo'
# ffa fastfetch, cpufetch, mem, and get-ip
alias ffa='cl ; echo ; fastfetch -c /usr/local/bin/neo-fastfetch.jsonc ; cpufetch ; free -th --mega ; bash /usr/local/bin/get-ip ; echo'
NOTES: + Ex. strftime string '+%A, %B %d, %Y - %I:%M %p %Z' result;
Friday, May 10, 2024 - 08:54 AM PDT
TODO: +
BUGS: ! NEO does not have a Real Time Clock (RTC) which causes the
fastfetch module "datetime" to show 1970 date & time. OK
See: https://github.com/fastfetch-cli/fastfetch/issues/911
+ Fix: Add module "command" using coreutils 'date' command OK
HISTORY: 4.0.0 - Fix Friday, May 10, 2024 08:00 AM PDT
+ deprecated fastfetch module 'datetime' due to NEO not
having a hardware-based Real Time Clock (RTC) OK
+ added custom module "command" using coreutils 'date' OK
+ 'date' strftime string; +%A, %B %d, %Y - %I:%M %p %Z OK
+ updated documentation OK
+ tested OK
3.0.0 - Minor Thursday, May 09, 2024 05:00 PM PDT
+ renamed to neo-fastfetch.jsonc to remove version info OK
- deprecated use of Nerd Fonts OK
+ modified alias ff to include cpufetch OK
+ added alias ffa with fastfetch, cpufetch, mem, and get-ip
bash script OK
+ updated documentation OK
+ tested OK
2.0.0 - Major Sunday, May 05, 2024 10:00 AM PDT
+ total rewrite based on '-c all.jsonc' output OK
- deprecated nerdfont icons OK
+ based on mhj-SEi12 ~/.config/fastfetch/mhj-0_2_0.jsonc OK
+ tested OK
+ updated documentation OK
1.0.0 - Minor Friday, May 03, 2024 03:00 PM PDT
+ modified systemd-analyze startup 'command' syntax to have
complete output on single line OK
+ tested OK
+ updated documentation OK
0.1.0 - Fix Friday, May 03, 2024 01:00 PM PDT
+ fixed systemd-analyze startup 'command' syntax OK
+ tested OK
+ updated documentation OK
0.0.3 - Major Friday, May 03, 2024 12:00 PM PDT
+ rewrite / reorganization of modules OK
+ added startup 'command' using systemd-analyze OK
+ tested OK
+ updated documentation OK
0.0.2 - Major Friday, May 03, 2024 11:00 AM PDT
+ using presets/examples/10.jsonc as a rough template OK
+ tested OK
+ updated documentation OK
0.0.1 Friday, May 03, 2024 10:00 AM PDT
VERSION: 4.0.0 - Stable
CREATED: Friday, May 03, 2024 10:00 AM PDT
REVISED: Friday, May 10, 2024 08:00 AM PDT
LAST TESTED: Friday, May 10, 2024 08:22 AM PDT
TEMPLATE VER: 1r-bookworm
LINUX DISTRO: Debian GNU/Linux 12.5 (bookworm) armv7l
SYSTEM INFO: neo-fastfetch
AUTHOR: MHJessen (mhj)
COMPANY: MHJessen Applied Solutions
LICENSE: MIT (or Bloodwine... old, very old, Bloodwine)
============================================================================= */
Thanks for the advice! Take care!!