clock

Updating TextView with clock

假装没事ソ 提交于 2019-12-06 15:53:51
问题 I have been trying to create a program that will output a working digital clock that will allow me to quickly access the date and time. I have the code to parse the time, however, I'm having difficulty updating the textview. I have this: `public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); timer = (TextView)findViewById(R.id.timer); time = new Time(); time.setToNow(); timeString = time.toString(); changeTime = Parser

Problem of understanding clock_gettime

筅森魡賤 提交于 2019-12-06 14:50:11
问题 I am having difficulties with the different clocks which can be accessed by clock_gettime . Especially I am interested in: CLOCK_REALTIME CLOCK_PROCESS_CPUTIME_ID CLOCK_THREAD_COUTIME_ID I read the manpage, but it didn't help me very much. I use clock_gettime in order to generate timestamps for my profiler when it sends the gathered data via socket. I have noticed the following differences: CLOCK_REALTIME The events I receive from my profiler with this clocks are sometimes, in a wrong order.

What's the most accurate way of measuring elapsed time in a modern PC?

一笑奈何 提交于 2019-12-06 14:11:55
I know I can use IRQ0, which is the system timer, but this is based on a 14.31818MHz clock, right? Is there anything offering greater precision? Thanks. Edit: Does anyone know what the Windows function QueryPerformanceCounter uses? "Precision" and "accuracy" mean different things. "The Earth's circumference is 40000.000000000 km" is precise, but not accurate. It's a bit more complicated with clocks: Resolution: time between ticks, or period of ticks. (You could probably call it "precision", but I think "resolution" has a more obvious meaning.) Skew: relative difference between nominal and

Windows 7 left click on clock popup

≯℡__Kan透↙ 提交于 2019-12-06 11:54:45
问题 When left single click on the clock in the taskbar on Windows 7 (maybe Vista too) a popup opens showing calender and clock(s) (thus not the date and time adjust window). How do I open this window myself (preferred in C#)? I was hoping timedate.cpl would call this, but this opens the date and time adjust window. 回答1: To show the clock you need to send the appropriate window message to the tray window. This can be done using the Windows API function SendMessage : using System; using System

Calculating shift hours worked and detecting

这一生的挚爱 提交于 2019-12-06 09:16:46
问题 I have a problem. My English is pretty bad. I need to do an overtime calculation with PHP. There is already a code for this. But when the working time is more than 2 days, the calculation is wrong. Working Start: 2018-09-09 13:43 Working End: 2018-09-11 07:13 Result: 07:18 | 04:00 | 04:00 | 02:00 | 17:18 I can't figure out the problem, please help. I'd like to give you more details, but I'm pretty bad. I hope you understand me. Thanks. <?php function intersection($s1, $e1, $s2, $e2,$day) {

Using BUFG to drive clock loads

时光总嘲笑我的痴心妄想 提交于 2019-12-06 08:23:41
I'm attempting to work with pixel data that is output to a DVI chip. A variety of clock frequencies are used because the DVI chip registers are programmed using I2C (therefore needs a clock < 500 KHz) - from a clock divider. The DVI chip needs a 40 MHz differential pixel clock, however, the DVI takes displays half a byte twice a cycle, so a further 80 MHz clock is needed to push each half of the pixel onto the data lines with each half cycle, these are from a DCM. This has led to a variety of problems. I attempted to just use the double pixel clock rate to swap each half of the pixel, however

Is the use of rising_edge on non-clock signal bad practice? Are there alternatives?

怎甘沉沦 提交于 2019-12-06 04:08:06
问题 I am working on a VHDL design and I have it working, but the code is pretty ugly and the fact that it seems that I am trying to work around the language's design to accomplish my goal makes me feel like something is wrong. I'm pretty new to VHDL, but I have been working on smaller chunks of the project for nearly a month so I have the general idea. However, This part is a bit more complex. I need a process that will create a one clock period long pulse (LOAD_PULSE) after the rising edge of a

How to have loop sync with UTC timer and execute at every new minute?

风流意气都作罢 提交于 2019-12-06 02:16:57
问题 I want to have a loop be executed once every minute when datetime.utcnow().second is zero. So far I have this while True: while datetime.utcnow().second != 0: pass do_something() But the problem with this is that I am wasting cpu processes. I would use time.sleep(60) , but I don't know how it would sync with the UTC clock, because time.sleep(60) could stray from the official UTC time as time passes. 回答1: Best way I can think of would be to sleep until the next minute: while True: sleeptime =

clock_getres and Kernel 2.6

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-06 01:49:46
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 According to "include/linux/hrtimer.h" file from kernel sources, clock_getres() will always return 1ns (one nanosecond) for high-resolution timers

Clock in C: Time light up [closed]

◇◆丶佛笑我妖孽 提交于 2019-12-06 01:02:42
For school I have to do a assignment, Im busy with it for like 3 weeks now and still havn't gotten far. We need to make a clock that has to be round and the colours of the seconds minutes AND hours need to light up. So if it's 4:25 am those numbers need to light up. This is what I've got right now: #include <stdio.h> #include <time.h> #include <conio.h> #include <unistd.h> #include <stdlib.h> #include <windows.h> int csecs (int cseconds ); void main (int sec, int min){ printf("Hallo! Veel plezier met het bekijken van de tijd!"); getch(); while (sec) { time_t cseconds; cseconds = time (NULL);