Tag Info

Hot answers tagged

14

On Windows, the system RTC clock is traditionally kept in local time. In Unix and Linux, it's traditionally kept in UTC, and /etc/localtime is used to indicate the current timezone so that the displayed time is correct. These two worldviews collide in dual-boot configurations, because there's only one RTC. Usually you tell Linux to assume that the RTC is ...


9

date +%s%N will give the nano seconds since epoch To get the micro seconds just do an eval expr `date +%s%N` / 1000


8

There's no much point asking for this kind of precision in a shell script, given that running any command (even the date command) will take at least a few hundreds of those microseconds. In particular, you can't really use the date command to time the execution of a command with this kind of precision. For that, best would be to use the time command or ...


7

System time You can use date to set the system date. The GNU implementation of date (as found on most non-embedded Linux-based systems) accepts many different formats to set the time, here a few examples: set only the year: date -s 'next year' date -s 'last year' set only the month: date -s 'last month' date -s 'next month' set only the day: date -s ...


6

I have found the solution thanks to the tip given by Nils and a nice article. Tuning the ondemand CPU DVFS governor The ondemand governor has a set of parameters to control when it is kicking the dynamic frequency scaling (or DVFS for dynamic voltage and frequency scaling). Those parameters are located under the sysfs tree: ...


6

Use date -s: date -s '2014-12-25 12:34:56' Run that as root or under sudo. Changing only one of the year/month/day is more of a challenge and will involve repeating bits of the current date. There are also GUI date tools built in to the major desktop environments, usually accessed through the clock. To change only part of the time, you can use command ...


5

The guest has no direct access to the host clock. Instead, it uses kvm-clock which points to a memory region updated by the host, from the host's clock. As such, the guest is using the host clock. The issue is that this memory region isn't updated constantly, it's only updated when there's a VM 'event', and as such, guests can drift and then lurch back to ...


5

You can use : sudo dpkg-reconfigure tzdata for configuring your timezone . For updating time and date from internet use the following : Install If ntpd is not installed use any one of the following command to install ntpd: # yum install ntp Configuration You should at least set following parameter in /etc/ntp.conf config file: server For ...


5

Use ntpdate, ntpd, or Chrony to connect to a NTP server.


5

Are there tools which measure time of day clock drift? The only tools I'm aware of are the NTP tools which should suffice. You don't have to actually configure ntpd to sync against a given clock source you can just use the -d option to ntpdate to fetch the calculated offset. Example: [davisja5@xxxadmvlm08 ~]$ ntpdate -d clock.redhat.com ...


5

The system clock and the hardware clock are not the same. The command hwclock -r should show you the time the hardware clock is set to. If it is incorrect, use the command hwclock -w to update it when the time is correct. If you dual boot with windows, you will want to use local time. Otherwise, you may want to set the harward clock to UTC with the ...


4

I've seen syslog entries like that on a Slackware machine a few years ago. I believe I bought the machine in question in 2002, and pretty much ran it 24/7 for years: it was my SSH, SMTP and HTTP server. The NTP failures came on slowly, and gradually increased in frequency. I fixed it the first time by changing the "CMOS RAM" battery, which was one of ...


4

To expand slightly upon @frostschutz comment, the TZ environment variable is present in large part to allow exactly what you desire: having programs show you time information in your preferred zone. Indeed, Unix system clocks all run on UTC (GMT-like) and things like file timestamps and what your clock program gets back from the system is in UTC. Programs ...


4

It sound slike one of your systems is configured to treat the hardware clock as localtime, while the other one treats it as UTC. Ubuntu docs leave me to believe Ubuntu is UTC by default, so probably your Arch isn't. You can check and set this by checking if timedatectl status | grep local returns anything, and set Arch to use UTC by saying timedatectl ...


4

By system clock I mean the clock that tells the time down right of the panel "System clock" generally refers to the clock maintained by the kernel; applications such as date and GUI clocks such as the one you refer to make calls to it like this. Why, out of all the processes that the system runs, does the clock need a shared memory segment? ...


4

As you said date +%s returns the number of seconds since the epoch. So, date +%s%N returns the seconds and the current nanoseconds. Dividing date +%s%N the value by 1000 will give in microseconds.i.e echo $(($(date +%s%N)/1000))


3

I see a few ways you can approach this Scan the filesystem for the file with the newest modification or access time. Use that time to set the clock. It's slow, and the accuracy is probably going to be far off, but it'll work. If you have a directory/file you know is modified fairly frequently, you could just use that as the source. Go with the idea you ...


3

As mentioned, the host writes the time to a page of memory that the guest can read. This generally means that the vm's hardware clock matches the host's, barring any bugs where the host doesn't write that page on critical events like scaling cpu speed. The issue is usually that the OS doesn't recognize that the hardware clock is changing/adjusting. A regular ...


3

Are you trying to keep the clocks synchronized to the right time, or are you trying to determine how accurate the real time clock actually is, without being synchronized? If you simply want the times to be correct, there's a whole hierarchy of time servers that systems can sync to, and it's often built in to the OS, although you can usually specify time ...


3

It is not the guest that triggers the upscale - the host must do this. So you have to lower the according trigger-level on the host.


2

The crony utility has a drift file. See: http://chrony.tuxfamily.org/manual.html#Configuration-options-overview I do not know the format of that file as I have not yet installed it myself. It does have a command to view the drift info: chronyc sourcestats -v I plan to install crony on my virtual machines as a start. This site looks helpful: ...


2

Use the NTP-daemon for this. Define a number of - independent - ntp-servers to contact (ntp.conf, server-directive). 3 servers are good, more are better. The network-time-protocol will sort out "bad" time sources. Look at the output from ntpq -p after you ran the ntpd for a couple of hours. You will see which primary server has been chosen, which ones are ...


2

Try booting the system with the kernel-option clocksource=jiffies or nohpet. I have an open case about SLES11 SP2 (using Kernel 3.0) where I observe time-mismatches on VMs. The clocksource=jiffies made it worse in my case - but in yours it might help. Currently the support is focussing on the high-precision-event-timer (but I doubt that your embedded ...


2

Take a look at the setup() function in /etc/init.d/kbd. It does a number of checks, like requiring that you're running /etc/init.d/kbd restart inside a virtual console before it starts vcstime. My guess is that you're starting it from within an xterm, via ssh, in screen, or something similar so it doesn't have direct access to your console.


2

It could be jippie is onto something after all: While the leap second was indeed inserted on July 1st, there's currently a bug in some GPS time systems (please read the full thread), that causes leap seconds to be announced continuously. In other words, the leap second flag has been announced from many top ranking time sources, every day since June 30th. ...


2

on the host, a kvm cpu looks like a process. The scaling mechanism doesn't watch processes, only the overall cpu consumption. and it is generally best practice to disable cpu scaling/throttling/etc when running VMs


2

Besides what was already said about kvm-clock, you might want to try the standard best practices - get away from tickless kernels, downshift the kernel ticks to 10 or so, enable ntpclient, make sure the host is not overloaded - time drift often happens during heavy CPU overcommit. If the VM has lots of virtual CPUs assigned, take that number down a few ...


2

GNOME 2 Don't know exactly how to do this but here are some things to investigate. gdm cache dir. I don't know how to change it but I found this: https://help.ubuntu.com/community/Locale. Looks like there is a file dmrc which some settings related to GDM. for example My file is located here for user "saml", /var/cache/gdm/saml/dmrc. [Desktop] ...


2

Some distributions are shipping rdate for that purpose. Basic usage: # just query bash-4.2$ rdate pool.ntp.org rdate: [pool.ntp.org] Wed Jun 12 11:05:40 2013 # set system time bash-4.2$ rdate -s pool.ntp.org



Only top voted, non community-wiki answers of a minimum length are eligible