Skip to content

ubus: expose unix timestamp in ubus system call #17

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fjamarquez
Copy link

Expose the unix timestamp in the ubus system call. In case the local time is different from UTC, the ubus call gets the local time and the unix timestamp.

root@c82c2b100000:~# ubus call system info
{
	"localtime": 1741345176,
	"unixtime": 1741341576,
	"uptime": 528,
	"load": [
		64,
		21984,
		20096
	],
	"memory": {
		"total": 124801024,
		"free": 46555136,
		"shared": 159744,
		"buffered": 53248,
		"available": 39346176,
		"cached": 33030144
	},
	"root": {
		"total": 1280,
		"free": 200,
		"used": 1080,
		"avail": 200
	},
	"tmp": {
		"total": 60936,
		"free": 60780,
		"used": 156,
		"avail": 60780
	},
	"swap": {
		"total": 0,
		"free": 0
	}
}

@Rondom
Copy link
Contributor

Rondom commented Mar 27, 2025

Out of interest: What is the use case behind this?

@fjamarquez
Copy link
Author

The main use case is to always get a unix timestamp from the AP, even if the AP is configured in another time zone. In that case, you will get the timestamp relative to the timezone configured and relative to unix time without the need of any manual conversion. For example, if the AP must always send the timestamp to any application in unix, it is easier if the AP gets the time directly in unixtime, than needing to know the local time zone configured in the AP in order to obtain unix timestamp. In case you have many APs configured with different time zones, you need to know the time zone of each one to get the unix of all of them. In addition, the configured timezone is not obtained from this ubus output. I think that it can be useful, but if you think it is out of interest, it is good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants