clock

How to account for clock offsets in a distributed system?

≡放荡痞女 提交于 2019-12-23 18:53:30
问题 Background I have a system consisting of several distributed services, each of which is continuously generating events and reporting these to a central service. I need to present a unified timeline of the events, where the ordering in the timeline corresponds to the moment event occurred. The frequency of event occurrence and the network latency is such that I cannot simply use time of arrival at the central collector to order the events. E.g. in the following scenario: E1 needs to be

WPF add a clock to my GUI

只谈情不闲聊 提交于 2019-12-23 11:47:18
问题 Simple Request - I want to be able to display the current time within my WPF application window. Are there free controls out there for this? Just need to display the time, nothing else. 回答1: I found what I needed at: http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/a813d92b-3d15-4f10-9984-5381517157d4/ 回答2: Have a look at this project over at CodeProject. 回答3: You could have a label or a text block and have its content bound to System.DateTime.Now 回答4: You can create an analog clock

PHP session expires immediately when client's clock is set in the future

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-23 08:57:53
问题 I have developed this PHP web application which is now running for some months. Suddenly one of the users complained that he was able to login, but the session was terminated as soon as he clicked on any button! The same problem happened on different browsers. After some tests I realized that a brand new session ID was created every time the user clicked on any button, probably because the original session was expired. For whatever reason I took a glance at the user's computer clock and...

Using java.time.Clock.offset to increment in time with an arbitrary starting time-of-day

谁都会走 提交于 2019-12-23 03:08:28
问题 I want a clock that is set to an arbitrary time-of-day, then ticks in one-second increments. For example, start with "14:55:20". Then my app should output "14:55:20", "14:55:21", "14:55:22" and so on in one-second ticks. It would seem that Clock.offset is meant to do just this. To quote the doc: Obtains a clock that returns instants from the specified clock with the specified duration added So I tried the following: LocalTime localTime = LocalTime.parse( "14:55:20" ); OffsetDateTime odt =

clock_getres and Kernel 2.6

让人想犯罪 __ 提交于 2019-12-22 10:39:52
问题 i'm using ubuntu 11.04 now and using v2lin to port my program from vxWorks tolinux. I have problem with clock_getres(). with this code: struct timespec res; clock_getres(CLOCK_REALTIME, &res); i have res.tv_nsec = 1 , which is somehow not correct. Like this guy showed: http://forum.kernelnewbies.org/read.php?6,377,423 , there is difference between kernel 2.4 and 2.6. So what should be the correct value for the clock resolution in kernel 2.6 Thanks 回答1: According to "include/linux/hrtimer.h"

Android and JNI real time clock

╄→гoц情女王★ 提交于 2019-12-22 09:37:08
问题 I got a problem with a mini Android application and the use of real time clock signals in a C (JNI) function. It seems like Android UI doesn't like real time signals from timers instanced in a C function. In the following PoC , a timer trigger a signal 5 times per second and if the signal is triggered while the UI is updating, the application crashes. If i don't start the timer => no crash If i don't put anything on UI => no crash I wrote this little PoC to evidence the behaviour. Java part

Getting a system-clock-change-tick in C#

眉间皱痕 提交于 2019-12-22 05:59:09
问题 Is their a way to execute a delegate or event in C# when the seconds, minutes, hours,... change in the system-clock, without using a timer that checks every millisecond if the property has changed and executes the event with a delay of maximum a millisecond. I thus want to avoid polling and fire an event at a certain time. 回答1: If your question is: "How do I execute a delegate every full second/minute/hour?" For minute and hour intervals, you could do something like shown in my answer in this

Time since first boot up

白昼怎懂夜的黑 提交于 2019-12-22 01:33:17
问题 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 save anything in SharedPreferences, but i need another solution, because this one does not work for some cases. Maybe there is any system property? Use case (excerpt from discussion) The filename of each file I receive from server includes a

How to measure function running time in Qt?

笑着哭i 提交于 2019-12-22 01:32:21
问题 I am calling argon2 - memory intensive hashing function in Qt and measuring its running time: ... QTime start = QTime::currentTime(); // call hashing function QTime finish = QTime::currentTime(); time = start.msecsTo(finish) / 1000.0; ... In argon2 library's test case, time is measured in another way: ... clock_t start = clock(); // call hashing function clock_t finish = clock(); time = ((double)finish - start) / CLOCKS_PER_SEC; ... I am calling the function exactly as they call in their test

Android number of clock ticks [Hertz]

≯℡__Kan透↙ 提交于 2019-12-21 21:36:50
问题 In question about "total cpu usage of an application from /proc/pid/stat" is explanation, how to get cpu usage, but to do it, we must know clock ticks. But how I can get this value in Android (directly from device)? I just don´t get how to use following function in Android, because it seems to be Linux command. Hertz (number of clock ticks per second) of your system. In most cases, sysconf(_SC_CLK_TCK) can be used to return the number of clock ticks. 回答1: Knowing the CPU frequency of your