![]() |
|
atomic clock - Printable Version +- Sinisterly (https://sinister.li) +-- Forum: Coding (https://sinister.li/Forum-Coding) +--- Forum: C, C++, & Obj-C (https://sinister.li/Forum-C-C-Obj-C) +--- Thread: atomic clock (/Thread-atomic-clock) |
atomic clock - dark_bit - 08-03-2017 This is my code, what i spec is to calculate miliseconds, but i just dont know how to start could you give a hand? i want this appereance when i run my program; [ 00 : 00 : 00.0000 ] i hope you understand what i want to do. any help or manuals would be useful Code: #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
void counter_Strike() {
for (int hour=0; hour<=24; hour=hour+1) {
for (int minut=0; minut<=60; minut=minut+1) {
for (int second=0; second<=60; second=second+1) {
system("clear");
printf ("[ %d : %d : %d ]\n",hour,minut,second);
sleep(1);
}
}
}
return;
}
int main(void) {
int day;
int thinker[]={1,0,-1};
counter_Strike();
return 0;
}RE: atomic clock - Bish0pQ - 08-03-2017 I just started learning C yesterday, I'll see if I can figure out what's wrong or how to do this. RE: atomic clock - titbang - 08-11-2017 (08-03-2017, 11:09 AM)Bish0pQ Wrote: I just started learning C yesterday, I'll see if I can figure out what's wrong or how to do this. This has to be done at OS level. If you're using Windows you can use GetSystemTime(). RE: atomic clock - dark_bit - 08-13-2017 (08-11-2017, 01:21 AM)titbang Wrote:(08-03-2017, 11:09 AM)Bish0pQ Wrote: I just started learning C yesterday, I'll see if I can figure out what's wrong or how to do this. Quote:i am on linux OS rigth now, so there is not any other way? RE: atomic clock - titbang - 08-13-2017 (08-13-2017, 06:17 AM)dark_bit Wrote:(08-11-2017, 01:21 AM)titbang Wrote:(08-03-2017, 11:09 AM)Bish0pQ Wrote: I just started learning C yesterday, I'll see if I can figure out what's wrong or how to do this. Here is a reference of functions for different systems. View the 'Retrieving system time' subsection. |