Questions tagged [time]
`time` is a command line utility for running another program and summarizing resource usage
495
questions
-1
votes
1
answer
14
views
Dualboot | After synced time on windows linux time is wrong
After i synced the windows time my hardware clock time is bad.
timedatectl
Local time: Sun 2023-10-01 15:38:05 CEST
Universal time: Sun 2023-10-01 13:38:05 UTC
...
6
votes
2
answers
1k
views
How can I set a time zone on a Linux machine that has only very minimal cmds available?
I have a Linux machine that only has very minimal cmds available on it, for example the /bin looks like this:
/bin# ls
ash chattr clockdiff dd dumpkmap ...
7
votes
2
answers
470
views
How to automatically set the modification (or creation) time of a Quicktime video file based on its meta data?
In a shell, how to automatically set the modification (or creation) date and time of a Quicktime video file based on the metadata in the file with a single command (or a single command line)? For JPG ...
1
vote
1
answer
87
views
Is there a command to make another command or process complete faster?
Background
I was using sudo renice -20 -p <pid> thinking it would make my videos convert faster.
On testing the time it had no effect and then I found out that speed has nothing to do with ...
1
vote
1
answer
201
views
Raspberry Pi timedatectl fails with "Transport endpoint is not connected" and ".service files" errors
I am encountering an issue on my Raspberry Pi when trying to use the timedatectl command. When I execute timedatectl status I get the following error message:
spaikon@raspberrypi:~ $ timedatectl ...
0
votes
0
answers
69
views
Time, Memory Limit and Timeout for Python Command Only
I want to enforce timeout of 5s to python command and at the same time want to measure the execution time for python command (taking into account that python3 command memory limit is 256 MB), what I ...
0
votes
0
answers
162
views
How accurate is the PPS device?
I am doing research in timing synchronization, and want to measure how time synchronization is impacted by injecting various faults into a system. I understand that the PPS devices on linux machines ...
0
votes
2
answers
87
views
Measuring execution time of BASH and custom shell
I have written simple shell in C with job control and piping/redirection functionality. How can I compare execution time(real,user and sys) of this shell with BASH ? I tried to measure time of ...
0
votes
1
answer
38
views
Set explicit time with date
When I tried to set time with
$(date +%s -d "2022-04-10 12:12:12")
I get the time
2022-04-10 19:12:12
How can I set the time explicit?
0
votes
2
answers
43
views
Get user's login duration time without time of locked screen
I'd like to get information about "utilization time" of users on linux sytems for specific days. This means the time, an user has an unlocked screen. In contrast the command ac displays the ...
1
vote
1
answer
378
views
Where is timedatectl information stored?
I am working on an embedded system without RTC battery. The time is synchronized via NTP when internet connection is available (which does not always happen). When the device is shut down, the time is ...
0
votes
0
answers
41
views
How can I measure how long cURL is taking to decrypt traffic?
How can I measure how long SSL decryption is taking during a cURL request on command line? I would've thought %{time_starttransfer} would be the time of the first byte before being decrypted (in a ...
0
votes
1
answer
48
views
How to add time in my script
I have 3 scripts to build OpenWrt but I can't set it up to have time at the end.
Here's what the script gives and the script.
openwrt-snapshot-r22256+29-14334c222e-ipq806x-generic-linksys_ea8500-...
3
votes
2
answers
287
views
Why does higher CPU-usage slow down a task?
I am using whisper.cpp to transcribe some sound files. It is a very CPU heavy process so I try to find some optimal settings and therefore I have done some tests with the thread setting (-t) but the ...
0
votes
0
answers
31
views
How to find the user input time lies between which two time frame stored in array in bash script [duplicate]
let the given array is array=(12:45 01:30 02:02 02:55 03:55)
so how to find the time let, 12:50 is lie between which two time frame(with index) is bash script
array=(12:45 01:30 02:02 02:55 03:55)
...
0
votes
1
answer
494
views
How to check how long is used to download a file from a linux server by using curl command?
I am testing the latency between 2 linux servers. A linux server is server and B linux server is client. I can download the file successfully by using curl command. But the time is too quick could be ...
-1
votes
1
answer
156
views
my clock doesnt work
My RTC clock doesn't work, on a particularly old piece of hardware, with equally old software. this messes with various processes like /proc/stat and ps, but it also throws errors ever time I try to ...
0
votes
0
answers
23
views
Copying folders within archive and preserve metadata
Im using 7zip in ubuntu 22.04 and Im using this command
7z l -slt "/media/azeem/368A-5AA7/airdroid test folder made with winzip.zip"
airdroid test folder made with winzip.zip file is what I ...
0
votes
1
answer
133
views
Add one second to yyyymmddhhmmss with awk
I have this file where the seventh field is a yyyymmddhhmmss. I need to increase just one second this number.
So far, I've come up with:
awk 'BEGIN{FS=OFS="|"} $7=$7+1 ' <file>
And ...
0
votes
2
answers
138
views
Last logins during last hour
OK, so basically I'm trying to give a specific date and time and I want to see all the logins that were made during the hour range, e.g. last hour or two last hours from the time and date given. I ...
0
votes
2
answers
520
views
missing btime in /proc/stat how do i fix it?
what does misning btime mean?
# ps aux | grep ssh
missing btime in /proc/stat
I'm on an embedded system (ts-7600)running a Debian version via UART.
#uname -a
Linux ts7600-4aa86d 2.6.35.3-571-gcca29a0+...
3
votes
2
answers
51
views
On Linux, how to get the elapsed time for any shell command being executed?
I'm compiling a big project where it could take hours to build it. While the project is being compiled, I would like to view the time it has taken so far since the compilation was started.
There is a ...
0
votes
1
answer
451
views
How to show seconds in time format of KDE lock screen?
I am using Russian locale and I use KDE. When locking screen with Meta + L, you see the current date and time on it. The time is in format "12:34". I want to change it to "12:34:56"...
0
votes
1
answer
193
views
How to save execution time of a script to variable while printing script's stdout to console?
I would like to measure time spent on a script and save it to a variable. This is my current code:
time_spent=$(time ./script.sh)
...
echo $time_spent
Here is how it should work:
The script output ...
1
vote
1
answer
20
views
Can `cal` show other Gregorian adoptions?
On my host I can show the adoption of the Gregorian calendar as it occurred for Great Britain and its colonies in 1752:
$ cal september 1752
September 1752
Su Mo Tu We Th Fr Sa
1 2 ...
1
vote
0
answers
658
views
Failed to start Network Time Synchronization
Can anyone let me know why I am facing Failed to start Network Time Synchronization at the kernel logs?
When I run timedatectl command I get the message
Failed to query server: Connection timed out
...
0
votes
2
answers
516
views
Issue with timedatectl
Hi can any help me how timedatctl works my understanding are
if system clock sysnc with NTP serivce through internet system time will be updated to current date and time.
If system clock sync with ...
0
votes
0
answers
52
views
How should I properly measure running time of a program?
I'm trying to measure performance of two implementations of a program (e.g progv1 and progv2 that do the same thing) using the time command, however not only they differ, but if I run time progv1 10 ...
2
votes
1
answer
98
views
How do you make every loop take exactly the same time?
ENV : GNU bash, version 4.2.46(2)-release (x86_64-redhat-linux-gnu) (It's old)
I want every loop takes equal time.
The loop never stops
The api_call function normally takes about 1s~5s.
The API call ...
2
votes
2
answers
397
views
How can the time command compute one millisecond from 4 ms timer ticks?
From the bash time command on different stock Ubuntu systems (both real hardware and VMs) all with CONFIG_HZ=250, I'm sometimes getting real 0m0.001s, user 0m0.001s or sys 0m0.001s as well ...
0
votes
2
answers
118
views
Compare Execution Times of Two Functions
I am attempting to write a function which will take two commands as inputs, time the executions of both of them, then output those times to a text file. After reading this post, I got most of the way ...
5
votes
4
answers
761
views
How can I make time measurement DRY in my bash scripts?
Based on this answer, to measure the time in my bash scripts I can use:
start_time="$(date -u +%s.%N)"
sleep 5
end_time="$(date -u +%s.%N)"
elapsed="$(bc <<<"$...
0
votes
3
answers
262
views
Read and convert date from file
I'm using a CentOS and I want to write a shell script. So
I have a file with a date:
>
> cat VM1_EOMAP_TIME.log
07 Sep 2022 16:30
>
And I want to get the minutes since current time and the ...
3
votes
1
answer
351
views
Is the kilobyte used by time and ulimit commands either 1000 (SI) or 1024 (old school) bytes?
From man time:
M Maximum resident set size of the process during its lifetime, in Kilobytes.
From ulimit -a:
max memory size (kbytes, -m) unlimited
But a "kilobyte" may mean ...
7
votes
1
answer
571
views
tee is faster than no tee
I have this simple bash script:
#!/bin/bash
for i in {1..1000000}
do
echo "hello ${i}"
done
That prints a message a million times.
I try to compare the performance of dumping all the ...
1
vote
0
answers
120
views
Multiple Scripts all in one with breaks [closed]
I’m writing a script where instead of using ‘sleep 600’ (for example), i actually want to execute another script for the same amount of time as sleep.
So basically, instead of “doing nothing” for 10 ...
20
votes
3
answers
3k
views
What's the POSIX-compliant way to get the epoch timestamp in a shell?
I just noticed, that POSIX date doesn't seem to have the %s or %N format items. So I can't use those. What's an alternative, yet POSIX-compliant way to get the epoch timestamp in my shell script?
1
vote
0
answers
22
views
Counter-intuitive date command [duplicate]
I've been using date in a script in order to add one year to a specific date the following way:
date '+%Y-%m-%d %H:%M:%S' -d "$DATE + 1 year"
In this example, DATE looks like 2022-05-11 14:...
0
votes
1
answer
490
views
How to store inner output of a nested bash command (within parenthesis) into one file and outer output into another file?
Here's my command:
(time ( \
time sleep 1; \
time sleep 2 \
) 2>&1 | tee inner.txt ) 2>&1 | tee outer.txt
cat inner.txt shows:
real 0m1.003s
user 0m0.001s
sys 0m0.002s
real ...
3
votes
1
answer
738
views
How to pass optional arguments to `time` command [duplicate]
man time shows it has some options, like this, to write just the time output to a file instead of to stderr:
-o FILE, --output=FILE
So, I try to use it
$ time -o out.txt ls
-o: command not found
...
0
votes
2
answers
1k
views
Unix Time Format with decimals
According to my understanding, Unix time format is the no of seconds calculated from 1970 00:00:00. For ex, if our current time is 1970 00:01:00, then unix time will be 60 (60 seconds has elapsed from ...
-1
votes
1
answer
918
views
Why is `time` not working on basic Bash script?
echo -e '#!/bin/bash\nsleep 10' > time_test.sh && chmod +x time_test.sh && time time_test.sh
time_test.sh: No such file or directory
real 0m0.186s
user 0m0.105s
sys 0m0....
0
votes
1
answer
144
views
Bash time converter
I have a question, How can I convert time from 12h AM/PM format to 24h?
For example, I have input from stdin, some text like this:
The event starts at 03:25PM and is expected to end at 06:17PM.
...
2
votes
2
answers
94
views
Show variable's value in output of time command in zsh
I want to measure runtime of my program for a series on input variables (I am using zsh):
for i in {1..3} ; do time sleep $i ; done
The output is
sleep $i 0,00s user 0,00s system 0% cpu 1,003 total
...
3
votes
1
answer
649
views
Check status of 11-Minute Kernel mode using adjtimex
I have a Debian Buster system which has the Kernel compiled without the CONFIG_RTC_SYSTOHC since I DO NOT want the 11-minute kernel mode to be on. However, I wanted to check if this change actually ...
0
votes
0
answers
21
views
Syncing Debian ntpd with Windows time server [duplicate]
unfortunately my problem listed here was not solved. It would seem that the issue was not with the ntpdate at all: when bypassing the university network all together, time sync works correctly.
The ...
1
vote
1
answer
602
views
Convert string time to seconds
I'm receiving an uptime in this format:
167h58m10.586582048s
I want to transform it to seconds and discard the fraction part.
I know awk could do that if only the received string had the same ...
0
votes
2
answers
193
views
Does the time command include the memory claimed by forked processes?
I want to benchmark some scripts with the time command. I am wondering if this command catches child processes' memory usage.
command time -f '%M' python my_script.py
If not, what are my options? Is ...
2
votes
1
answer
3k
views
Automatic time synchronization: `ntpdate` works but `chrony` does not
I have a problem with time synchronization of my Linux server. Both this machine and the NTP server are located in a (smaller) university data center hence the local address.
What is strange is that ...
0
votes
1
answer
311
views
Show only dates bigger than the search pattern even if the search pattern does not exist in the (log) file
I want to search the syslog for dates bigger than a specific search pattern. For example I want to find every syslog entry where the date is bigger than JAN 6 16:24:00. I know I could use sed (sed -n ...