kisslinux / kiss

KISS Linux - Package Manager
https://kisslinux.github.io
MIT License
464 stars 62 forks source link

kiss: time the building of a package #282

Closed echawk closed 2 years ago

E5ten commented 2 years ago

date +%s isn't POSIX

E5ten commented 2 years ago

a hacky, but as far as I know POSIX way to get time in seconds would be

stime=$(awk 'BEGIN{ srand(); print srand() }')

(the first srand call is needed because POSIX says "Set the seed value for rand to expr or use the time of day if expr is omitted. The previous seed value shall be returned.", so impls wouldn't necessarily return time on the first srand call, as the seed value for rand hadn't been initialized yet.

echawk commented 2 years ago

Shoot, I forgot to check POSIX. I can switch to using awk.

dylanaraps commented 2 years ago

Builds can be timed via hooks. (Grab uptime at build start and build end, calculate elapsed time). Also, one could simply use the time command for this purpose (though without ability to control output format). I do not think this feature is needed in the package manager.

Thanks for the PR.