Questions tagged [clock]

Hardware and system clocks used by drivers, OS and hardware languages.

Clocks are key to controlling synchronous logic and are used by drivers, and OS software. As well, hardware languages, such as and can make extensive use of clocks. CPU or system clocks are familiar to most developers, but a typical computer can contain many different clocks to control different hardware functions such as video, audio, RAM, buses, etc. Familiar current time functions are often derived from a hardware clock which produces interrupts allowing an OS to keep a running time count by recording the interrupt; sometimes called ticks or jiffies.

Related tags

  • - obtaining, formatting times and other uses.
  • - program issues dealing with dates.
  • - measuring execution time with a clock.

See also: PLL, Clock divider

2060 questions
30
votes
5 answers

faster equivalent of gettimeofday

In trying to build a very latency sensitive application, that needs to send 100s of messages a seconds, each message having the time field, we wanted to consider optimizing gettimeofday. Out first thought was rdtsc based optimization. Any thoughts…
Humble Debugger
  • 4,439
  • 11
  • 39
  • 56
30
votes
6 answers

Clock synchronization quality on Windows Azure?

I am looking for quantitative estimates on clock offsets between VMs on Windows Azure - assuming that all VMs are hosted in the same datacenter. I am guesstimating that average clock offset between one VM and another is below 10 seconds, but I am…
Joannes Vermorel
  • 8,976
  • 12
  • 64
  • 104
29
votes
5 answers

Linux clock_gettime(CLOCK_MONOTONIC) strange non-monotonic behavior

Folks, in my application I'm using clock_gettime(CLOCK_MONOTONIC) in order to measure the delta time between frames (a typical approach in gamedev) and from time to time I'm facing a strange behavior of clock_gettime(..) - returned values…
pachanga
  • 3,003
  • 4
  • 30
  • 45
28
votes
17 answers

Making a live clock in javascript

The clock kinda works. But instead of replacing the current time of day it prints a new time of day every second. I understand why it does that but I don't know how to fix it. I would appreciate if you could give me some tips without saying the…
WilliamG
  • 451
  • 1
  • 8
  • 16
28
votes
4 answers

How do I generate an alert at a specific time in C#?

How can i generate an event at a specific time? For example, say I want to generate an alert at 8:00 AM that informs me its 8:00 AM (or an event that informs me of the current time at any given time).
Mobin
  • 4,870
  • 15
  • 45
  • 51
27
votes
3 answers

How to get the precision of high_resolution_clock?

C++11 defines high_resolution_clock and it has the member types period and rep. But I can not figure out how I can get the precision of that clock. Or, if I may not get to the precision, can I somehow at least get a count in nanoseconds of the…
towi
  • 21,587
  • 28
  • 106
  • 187
27
votes
2 answers

What are the uses of std::chrono::high_resolution_clock?

At first I thought it can be used for performance measurements. But it is said that std::chrono::high_resolution_clock may be not steady (is_steady may be false). It is also said that std::chrono::high_resolution_clock may even be an alias of…
anton_rh
  • 8,226
  • 7
  • 45
  • 73
27
votes
6 answers

How to check HZ in the terminal?

I have seen this http://kaasxxx.wordpress.com/2008/01/22/linux-hz-checker/ But the script seems not to work. Does anyway know an easy way to check "HZ" in the terminal in Linux?
Hao Shen
  • 2,605
  • 3
  • 37
  • 68
25
votes
6 answers

Android: How do I display an updating clock in a TextView

have a clock I want to display in a TextView. I would have thought there was a few nice functions to do this, but I couldn't find anything. I ended up implementing my own way that uses a Handler. What I'm asking though, is there a better (more…
Richard Rout
  • 1,296
  • 1
  • 15
  • 28
24
votes
3 answers

Java 8 LocalDateTime.now() only giving precision of milliseconds

Is it possible to get microseconds in Java 8? The Java 8 LocalDateTime class has a .getNano() method which is meant to return nanoseconds, but on both Linux(Ubuntu) and OS X (10.11.5) it only returns milliseconds (when I ran it it returned 301000000…
annedroiid
  • 6,267
  • 11
  • 31
  • 54
23
votes
3 answers

How accurate is the GPS Clock?

In my company we do have critical systems that require an accurate time. As so, we have an NTP server appliance with an outdoor GPS antenna that receives the time from the GPS satellites. My questions are: How accurate is the time clock? Is it…
Andre
  • 598
  • 1
  • 7
  • 18
23
votes
5 answers

Time since first boot up

I'm developing an android application and hit the problem with determining system first boot up time. I mean i need to measure how much time already passed from device first boot up. I know about solution with listening for ACTION_BOOT_COMPLETED and…
user2857033
  • 339
  • 4
  • 6
22
votes
6 answers

Detect with javascript if user's machine is using 12 hour clock (am/pm) or 24 clock (military time)

Is it possible to detect if user's machine is using 12 hour clock (am/pm) or 24 hour clock (military time)? One way would be to check users locales, but then it is just massive list of locale comparison and someone from U.S who wants 12 hour clock…
Badr Hari
  • 8,114
  • 18
  • 67
  • 100
22
votes
3 answers

Monotonic clock on OSX

CLOCK_MONOTONIC does not seem available, so clock_gettime is out. I've read in some places that mach_absolute_time() might be the right way to go, but after reading that it was a 'cpu dependent value', it instantly made me wonder if it is using…
Brett
  • 4,066
  • 8
  • 36
  • 50
21
votes
5 answers

Detect current CPU Clock Speed Programmatically on OS X?

I just bought a nifty MBA 13" Core i7. I'm told the CPU speed varies automatically, and pretty wildly, too. I'd really like to be able to monitor this with a simple app. Are there any Cocoa or C calls to find the current clock speed, without…
Tim
  • 14,447
  • 6
  • 40
  • 63