title: Program a simple clock in C
body: <blockquote>
    <p>Write a program to simulate simple digital clock displaying </p>
    
    <p>HOURS(s) : MINUTES(s):  SECOND(s)</p>
  </blockquote>
  
  <ul>
  <li><p>How to get local system time ?</p></li>
  <li><p>How to split local system time into hours , minutes and seconds ?</p></li>
  </ul>
  
  <p>Edit 1:</p>
  
  <p>This is what I have tried, but its far from perfect (dosnt even use time.h)</p>
  
  <pre><code>     #include &lt;stdio.h&gt;
       #include &lt;conio.h&gt;
       #include &lt;dos.h&gt; void main() { int h,m,s; h=0; m=0; s=0; while(1) {
  
       if(s&gt;59) {m=m+1; s=0; } 
        if(m&gt;59) { h=h+1; m=0; } 
        if(h&gt;11) { h=0; m=0; s=0; } 
        delay(1000); 
        s=s+1; 
        clrscr(); 
        printf("\n DIGITAL CLOCK");
        printf("\n HOUR:MINUTE:SECOND"); 
        printf("\n%d:%d:%d",h,m,s); 
  }
  
  }
  </code></pre>