Questions tagged [time]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
15 views

RHEL ways to simulate or virtualize time

I am trying to get my machine to simulate or visualize time without changing system time so that I can run code under simulated/virtual time so that my timestamps are in the past and such. I know ...
1
vote
1answer
36 views

faketime ignoring chronyc sources

I'm trying to do a "chronyc sources" call but with faketime. When in a terminal, "chronyc source|cat" works fine, but when I do faketime 'last friday 5pm' chronyc sources|cat, it ...
2
votes
1answer
25 views

How to configure openntpd to only rarely connect to NTP servers and sync the clock (or only when a large clock drift was detected)?

Because the clocks of multiple of my Debian/KDE machines went off by many minutes for no apparent reason and common mainboards (or at least the one that I have) don't have accurate, reliable hardware ...
0
votes
1answer
50 views

How to pipeline sleep? sleep pipeline doesn't work

I wanted to simulate execution time of certain scripts for which I found sleep NUMBER does exactly what I want. In my scenario I needed something like sleep 5 | command | sleep 5 ... But it behaved ...
0
votes
0answers
33 views

How can I measure time spent in child processes?

I have a command which invokes another command (synchronously) a couple of times. Is there a way to get the total time spent in the subcommand? In other words, is there a command similar to time but ...
0
votes
1answer
40 views

Why do many Web sites miscalculate my current time?

I am using Debian. My clock shows the current time. I set the BIOS to Greenwich, but then the time is adjusted to the current time zone. But when I visit many Web sites, they think I'm visiting from a ...
0
votes
1answer
14 views

debian mate desktop environnment time problem

I have mate environment and impossible to set up the time ... the time is set 5 hours later, and I set the time + time zone but the time stays like it.. idea how to change it? thanks
0
votes
1answer
12 views

C-std headers containing helper functions for system, user and kernel times?

Basically, I am working with Nvidia's new github repos and trying to compile them in a cross-platform setup. Specifically, I am trying to compile them on Fedora 33. I have run into an issue: In file ...
0
votes
1answer
20 views

How to calculate the difference between two time durations?

Here's what I tried $ dateutils.ddiff 02:15:00 00:26:00 -6540s $ dateutils.ddiff -i %T 02:15:00 00:26:00 -6540s $ dateutils.ddiff -i "%T" 02:15:00 00:26:00 -6540s $ dateutils.ddiff -i &...
0
votes
1answer
31 views

How to get the task_struct of a pid?

I would like to get the task_struct of a process by his PID because I need the timing fields for a monitoring application. Is that possible without creating a module ? If not, is there a way to get ...
0
votes
0answers
35 views

Bash time mesure performance

I am writing code in C ++ and I would like to test the performance of its functions. I've measured this before, but with the implementation of the chrono library and the for loop in bash, but the ...
1
vote
1answer
33 views

Set execution time for Script command to record terminal activity

I want to set up a script to record terminal activity. After seeking out various sources, I came up to the idea of using Script command to perform this task. However, if I only use Script command, ...
0
votes
1answer
59 views

How to replace Shuf with rand (from C++) with a seed of time in order to make my script more random [closed]

I have this script that extracts 200 random characters from a set: tail -n+2 file.fasta | tr -d '\n' > newfile n=$(stat -c "%s" newfile) r=$(shuf -i1-"$((n-200+1))" -n1) newfile ...
2
votes
2answers
28 views

How can I display custom year on my system?

As you know, most countries use the notion of the "Common Era", which is traditionally linked to the Christian religion. For instance, Unix epoch time is being counted from January 1, 1970. ...
0
votes
0answers
20 views

Utility to read and set time of Xen hypervisor?

Running PVMs in Xen I learned that there are at least four "system times": The time in RTC (hardware Real-Time-Clock) The time in the Xen hypervisor The time in Dom0 The time in a PVM When ...
0
votes
1answer
19 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
2answers
34 views

Formatting current time [duplicate]

I would like to get time in below format 2020-10-12 10:41:42,526 How can it be done. I tried this but looks not correct date +"%Y-%m-%d %H:%M:%S,%N"
0
votes
0answers
60 views

Handling USER_HZ and the output from cpuacct.usage

I am writing a program that is supposed help run foreign code "safely". I also want to get the memory utilization and CPU compute time for the foreign code so I thought I would use cgroups. ...
2
votes
1answer
78 views

Any way to make system time go slower or faster?

I'd like to make the system clock go slower or faster on Linux. On Windows, there's a very useful freeware called "Time Travel". To get an idea of what it does, just check this image, ...
0
votes
0answers
27 views

Why is systemd-analyze more accurate than dmesg?

It seems dmesg measurement is not reliable since it merely collects output from drivers and other processes. But I'm curious how exactly does systemd-analyze do the job better? I'm not quite familiar ...
0
votes
1answer
25 views

Does running time on an executable significantly increase run time

Does running time on a shell command noticeably increase the runtime of the command itself? After all, since it distinguishes between time spent in user space and time spent waiting for system calls ...
0
votes
2answers
56 views

How to disable caching when using the time command?

When running time on process/application, it seems like it always cache the result/process, and thus doesn't give the real timing of the process. I tried: sync; time process and sync -f; time process ...
2
votes
3answers
247 views

How to profile wall-clock time?

In my program, real time duration is sometimes as much as 3 times that of cpu time. This is a single thread application that does a lot of memory allocation and NFS base read/write. So my doubt is ...
1
vote
1answer
814 views

Wrong time on archlinux

The system is located in Italy, and executing date gives Fri 7 Aug 16:15:56 CEST 2020, whereas the actual time is 14:21:09. Executing timedatectl status gives: Local time: Fri 2020-08-...
2
votes
1answer
118 views

Cronjob timing accuracy - planned time as a parameter

I would like to know how accurate and certain cron timing is. Lets say I got cronjob to run at 11:00:00 and then I pass time as a parameter for this cron job. Would it be possible, in any scenario, ...
1
vote
0answers
24 views

How to retrieve a systemctl service's notion of the “current time” (CRON jobs run two hours early)?

My scheduled CRON jobs run two hours early, although both date and hwclock reports the correct time for my timezone. I've read that a possible solution would be to restart cron.service (CRON) after ...
28
votes
1answer
3k views

These two Bash lines are functionally equivalent. Can someone explain why one is faster?

$ time if [[ $dir2 -ot $dir1 ]] ; then open $dir2 ; else open $dir1 ; fi real 0m0.055s user 0m0.023s sys 0m0.018s $ time [[ $dir2 -ot $dir1 ]] && open $dir2 || open $dir1 real ...
-1
votes
1answer
32 views

How to search in Ubuntu/Linux using two different date?

Please assist. I am trying to search few events in Ubuntu from auth.log and syslog in /var/log/ folder using two different date range, how can I do it? My Code is like below with only one date range ...
0
votes
2answers
71 views

Debian on Synology NAS keeps changing timezone

I have a Debian setup running on Synology NAS Virtual Machine Manager and it keeps changing the timezone. At the top of the screenshot above you can see that the timezone was GMT -4. then, at the ...
1
vote
1answer
69 views

How date command keep tracking time

I got a weird scenario in which the date of my computer is getting the wrong time (and he keeps fixing the time but still keep repeating this issue) let me share with you an example who make this much ...
-2
votes
2answers
97 views

convert milliseconds column to seconds in a csv file [closed]

I have a large tab separated file without headers like this: Tue Jun 09 18:06:53 GMT 2020 1591726013187 Tue Jun 09 18:20:31 GMT 2020 1591726831779 Tue Jun 09 18:09:01 GMT 2020 1591726141456 ...
0
votes
1answer
51 views

Copy latest file from one server to another at specific time

I want to copy a latest file of file.txt from Linux server A to server B at a specific time . It may be a duplicate question but i could not find the solution for this. Everyday I need to wait util ...
0
votes
3answers
264 views

Time elapsed of a bash script (days/minutes/seconds)

Infact when i want to have an estimated time it took when a script is finished. startdate=$date stuffs enddate=$date I wished to get the difference between these two dates and normally the script ...
1
vote
0answers
107 views

Linux Time persist through reboot issue

I have a custom board that houses a System on module(SOM) running linux kernel 4.4.15 The board has an RTC that is backed up via small battery. I have the board running with no network connection ...
0
votes
1answer
33 views

Write only differences with watch -d command

I have to use watch in order to write in a file (doc.txt) the differences between a new version of a file and an older. I tried watch -t -d -n 10 "cat myfile.txt | tee doc.txt" but all myfile.txt's ...
1
vote
1answer
49 views

Why is ls much slower than echo *? [duplicate]

(Inspired by the comments for this question) Why is ls this much slower than echo *? $ time bash -c 'for i in {1..10000}; do ls -f > /dev/null; done' bash -c 'for i in {1..10000}; do ls -f > /...
4
votes
3answers
479 views

iptables rule to unblock internet acess, and block it again 3600 seconds later

I do this, from my son's terminal, to sometimes give him internet access (disabled by default): ./unblockinternet.sh <enter password> with this script: su -c "iptables -D OUTPUT -m owner --...
1
vote
1answer
86 views

Differences between (command) and command in bash

While investigating the problem of redirecting the stderr of the bash keyword time and the standard solution to the problem, I came across another question. The description man bash gives of the (list)...
3
votes
0answers
72 views

Measuring cumulative peak memory usage of multiple parallel processes

Imagine I run a bunch of processes in parallel using xargs and want to measure their cumulative peak memory usage. How can I do that in Linux? GNU time only measures peak RSS of a single process I run....
0
votes
1answer
217 views

Are file modification times in UTC or in the local time zone?

If I touch a new file, I see that its modification time is showing as the current time in my local time-zone rather than in UTC. If I were to copy that file to a machine that's in another time-zone, ...
2
votes
0answers
33 views

bash: pass each command through time command (to measure execution time)

How to pass each command (typed in the shell) through time command? Reason of the question: need to measure execution time of each command (without typing time each time). Example (wanted behavior): ...
4
votes
3answers
358 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
116 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 ...
3
votes
3answers
128 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
30 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
59 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
341 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(...
1
vote
1answer
101 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
26 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 ...
2
votes
1answer
34 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 ...

1
2 3 4 5
9