Questions tagged [time]

`time` is a command line utility for running another program and summarizing resource usage

Filter by
Sorted by
Tagged with
2
votes
3answers
53 views

Log background job execution time

I have a script I execute in the background and capture all output with a command like this: nohup bash -x test.sh < /dev/null > log.txt 2>&1 & How can I find out how long it took ...
0
votes
0answers
22 views

wrong time on Virtualbox client

I have a Virtualbox host (6.0.16 r135674 (Qt5.9.5)) on Ubuntu 18.04 with a client running Ubuntu 16.04 with guest additions installed and the guest's time keeps being out of sync with the host. How do ...
2
votes
3answers
53 views

How to `time` a command N times (and be able to use CTRL-C to stop it)

Short question: This is done on a Mac: time for i in {1..10}; do python3 foo.py ; done but CTRL-C won't be able to stop it. How to make it work? (or how to time the running time of N times?) ...
0
votes
1answer
21 views

Does the system need to be at the right hour in order to get a GPS fix

I am using an ARM device on which Debian is installed. A GPS chip is installed on the machine and I use it in my program. That being said, it seems extremely, long, or sometimes impossible to even ...
0
votes
1answer
32 views

Using stat for time or date -r?

I have listed properties of a folder this way stat -c $'-------------- File: %n Size: %s Owner: %U Group: %G Permissions: %A' but I am having ...
0
votes
0answers
39 views

convert mtime to to human-readable date

I have different mtime values, and I am trying to convert them to human-readable date. I am triyng to achieve this using python: import time t = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(...
0
votes
1answer
33 views

How to switch panes in tmux and then begin typing immediately

I can successfully switch panes in tmux with the following command: Ctrl+bleft arrow (or any other direction) However, because I am impatient, I usually want to start typing in the new pane ...
1
vote
1answer
22 views

How to get sleep time of a program

I am trying to collect some statistics for a script that I run on a daily bases. I would like to get the amount of time that is actually spent sleeping. Is there a way to just get the sum of all sleep ...
0
votes
0answers
26 views

Bash: time a command only if successful [duplicate]

I have a command in a repeatedly running bash script for which I need to collect timing info and save in a file. I use the following form: time (cmd >/dev/null) 2>>timing.txt However, the ...
2
votes
1answer
27 views

Block commands at certain times of the day

I was wondering if anyone knew of a way to block certain commands from particular users/groups on any Linux distro (or most, if not all distros) at certain times of the day. What I would ideally like ...
0
votes
2answers
129 views

Which code works (with builtins) both in bash and zsh with the `time` keyword?

It is usual to do time cmd for many types of cmd(s) in bash: $ time true real 0m0.000s user 0m0.000s sys 0m0.000s The output format could be changed (even to a posix format with time -p): ...
0
votes
1answer
80 views

`time <command>` is different in zsh than in bash

Format of time <command> in bash: $time ./test.sh real 0m0.000s user 0m0.006s sys 0m0.000s In zsh: $time ./test.sh ./test....
0
votes
3answers
39 views

Invalid date on one system; perfectly valid on another system?

My code takes a start hour, and then defines a few other date/time variables from that start hour. Like so: shour=$(date -d "yesterday 3PM" -u) dd=$(date "+%d" -d "$shour" -u) sdate=$(date "+%Y%m%...
1
vote
2answers
51 views

Adding time to a time variable

I'm trying to add 3 hours to my time variable like so: today3AM=$(date -d "today 3AM" "+%Y%m%d%H" -u) today6AM=$(date -d "${today3AM} + 3 hours" -u) echo $today6AM Something isn't quite right as ...
2
votes
0answers
46 views

2038 problem behaving differently in different time zone

I am working on 32 bit linux and i understand 2038 problem https://en.wikipedia.org/wiki/Year_2038_problem Anyhow , when i try to use date command to set time beyond 03:14:07 UTC on 19 January 2038 ...
0
votes
0answers
32 views

How to set correct time on Windows and Ubuntu

I'm on Windows 10, with a VMWare guest Ubuntu. Following commands show they have different time, Ubuntu is ahead by 1 second. ~$ ssh ubuntu date +%s;date +%s 1578128791 1578128790 Then I ...
0
votes
0answers
36 views

Timer to know when script ended with total time [duplicate]

I wrote some bash script, which should run approximately around 1-2 hours. I want to add timer that will capture the time that script is running, is it possible ? ./script.bash . . . . TOTAL TIME =...
1
vote
0answers
24 views

time command stdout not working [duplicate]

I ran the time command on Linux and redirected the output to a file time > time.out The above command didn't work. The output time command was displayed on the terminal, the file named 'time.out'...
0
votes
1answer
46 views

Live time in prompt - bash

Is there any way to have the live time in the promt, such that when I execute a command, the time shown is the time the command was executed? So far I'm using S1="[\t me@here]\$ " for example, and ...
4
votes
1answer
59 views

Change perception of real time for one process

I would like to change the perception of real time for one process. Making the process believe that time is passing at 50% or 150% of the speed my system/kernel/hardware-clock thinks. I'd like to ...
1
vote
1answer
49 views

How can I estimate the whole time of a write process including sync?

Progress and estimated time to write without and with sync I have found no tool (or straightforward method) that will include flushing the buffers when showing the progress and estimating the ...
0
votes
0answers
34 views

How can I kill a process if it exceeds a timeout duration while also measuring its resource usage?

I'm currently using GNU time to measure the memory usage and runtime of a program. This is working great. However, I have noticed that in rare cases the program in question never exits, or takes a ...
-2
votes
3answers
59 views

how to build stable NTP server

we have in some room ( with no connection to internet network ) , linux redhat servers we installed the NTP clients based on crhony service on all machines to sync to NTP server now we want to ...
0
votes
1answer
88 views

is it mandatory to configure the allow in chrony.conf

according to the redhat document - https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system_administrators_guide/sect-understanding_chrony_and-its_configuration allow ...
0
votes
0answers
260 views

time on machines change after some time in spite chrony service configured

we have machines in cluster before one week we restart the chrony service , and we check the time on all machines after chrony restart time was ok on all machines after 2 days we noticed that on ...
1
vote
1answer
61 views

why does NFS require synchronized system clocks?

In multiple tutorials abouts setting up NFS, there are recommendations about setting up NTP as well to avoid differences between the clocks of the different systems. Do clock drifts affect the file ...
0
votes
0answers
27 views

How can I time a shell command n times and get some execution time distribution?

I have a shell command that I would like to time (e.g., a curl query). I don't want to time it once, but instead many times, so that I can get an empirical distribution of the execution time. How can ...
0
votes
1answer
38 views

Does clock() return process or overall system clock count?

I'm trying to count the time it takes for a code segment to complete. But I'm not looking to determine the time it takes for the process to run, but rather the time it took all things considered, eg ...
2
votes
1answer
68 views

Various syntax errors when measuring the execution time of a script

Using Cygwin (W10) I've historically used this to measure the execution time within a script: #!/bin/sh (time { sleep 1; }) I've now moved to Debian (Windows Subsystem for Linux) and the same ...
7
votes
2answers
629 views

Set time zone without root privilege

I'm connecting to my remote SSH Debian server account with no root privileges. Is there a way to change/set the time from the server's local time (US) to my local time (Poland; Central European Summer ...
0
votes
1answer
50 views

What do the parameters in the NTP response mean?

When I add the following line to the systemd-timesyncd.service : Environment="SYSTEMD_LOG_LEVEL=debug" I get the following output when syncing the system time: systemd-timesyncd[42507]: Sent NTP ...
-1
votes
1answer
34 views

File modification time before the write started

It seems that stat command displays the modification time before I started to actually write to the file. It can be replicated with this script date --iso-8601=ns touch file.txt stat file.txt The ...
-2
votes
1answer
380 views

is it important to set system hardware clock from the system OS

we have redhat 7.2 machines ( some of them are physical machines , and some of them are VM machines ) After my client computers have synchronized with the NTP server, we are thinking to set the ...
1
vote
0answers
35 views

How to determine if file has been modified in the last x seconds

I want to determine if a file has been modified in the last x seconds on MacOS or Debian etc. is_file_older_than() { seconds="$1" file="$2" echo "The file $file" modified_secs="$(date -r "$...
-3
votes
1answer
107 views

chronyd or ntpd + What are the benefits when using chronyd?

We have Red Hat Linux 7.5 machines and we need to decide between ntpd or chronyd service. What are the difference between chronyd to ntpd? When is more useful to use chronyd instead of ntpd?
-1
votes
1answer
39 views

How to measure how long I use an editor?

Does anyone know how to solve the following: A programming course wants to measure how much time it takes to solve the exercises. I use Ubuntu 19.04. Let's say I write the code by using Visual Studio ...
0
votes
1answer
46 views

How to sum time with part of milliseconds using bash?

How get sum, for ezample 00:03:03.333, of 00:01:01.111 and 00:02:02.222 into variable EPOCH='jan 1 1970' offset=$EPOCH lsdvd -c VIDEO_TS | grep "Length:" | grep "Chapter:" | awk '{print($4)}' | ...
1
vote
1answer
172 views

Printing milliseconds with GNU time

I am using GNU time for benchmarking and would like to measure real, user and sys time to the nearest millisecond. That is, I want to measure seconds to 3 decimal places, not the default 2. Does GNU ...
2
votes
2answers
414 views

How can I categorize files in a directory based on their content?

I have a directory which contains a lot of CSV files. The CSV files have many columns the first of which is a timestamp (as number of seconds since the UNIX Epoch). I want to categorize files in the ...
1
vote
0answers
15 views

Why Zsh `time` not work for some commands? [duplicate]

Why Zsh time not work for some commands, ➜ ~ type time time is a reserved word ➜ ~ time sleep 1 sleep 1 0.00s user 0.00s system 0% cpu 1.004 total # not work for echo ➜ ~ time echo hello hello # ...
1
vote
1answer
101 views

Ubuntu 18.04 Desktop - date and time synchronization issue

I did a clean install of Ubuntu 18.04 LTS on my laptop a couple of days back. During installation, I chose the timezone to be my local time zone i.e., Kolkata, India (Indian Standard Time). However, ...
3
votes
1answer
441 views

How to correctly fake time?

In order to resolve a specific timezone related bug on a software project that I'm working on, I'm trying to replicate a change on the system's clock using timedatectl to check my software behavior. ...
1
vote
0answers
36 views

How to write `time` it takes for script to run to file? [duplicate]

I'm trying to measure how long it takes my script to run with time on command line. I would like to have the time commands out put written to my output file. This is the command I have so far: time ./...
0
votes
1answer
51 views

time printing its output before the command it runs

I have a bash script with a line like this: /usr/bin/time rsync -av user@host:/some/remote/path/ /some/nfs/path/ Sometimes, the output looks like this: 0.03user 0.02system 0:00.21elapsed 26%CPU (...
0
votes
1answer
187 views

Bash: Parse the “Real” output of time of a command, check for output string, add time stamp and send it to an output file

Not a script person. I am trying to build a repetitive test to see how long a command takes to run, marks if it's successful or not, and adds a time stamp, and appends everything to a log file. Oh,...
1
vote
1answer
52 views

Ubuntu machine time issue

New to ubuntu. I see that my machine has wrong time set in the system. Can some one help how to correct the system time. timedatectl shows Local time: Tue 2019-07-16 03:53:00 IST Universal ...
0
votes
1answer
36 views

Bash: measure CPU time from launch until exit of an already running process

I'd like to use bash's builtin time command to measure the remaining cpu/user time used up by a program that is already executing. More precisely, I would like to write a bash script that, given a ...
0
votes
2answers
23 views

environment variable on the line messes up time output

check this out $ time echo 1 1 real 0m0.000s user 0m0.000s sys 0m0.000s $ TESTVAR=TEST time echo 1 1 0.00user 0.00system 0:00.00elapsed 0%CPU (0avgtext+0avgdata 1932maxresident)k 0inputs+...
1
vote
1answer
559 views

Time measurement in the Linux kernel

I want to measure time intervals in my kernel. I know nanoseconds are not really precise but I need more precision than milliseconds. There are many many functions to get a time. Jiffies, time of day,...
0
votes
1answer
58 views

automatically detect date format from string in linux?

I have a date 20190620_113859 which is from date +%Y%m%d_%H%M%S Is it possible to detect that +%Y%m%d_%H%M%S format from 20190620_113859 as input like $ date --detect-format '20190620_113859' %Y%m%...

1
2 3 4 5
8