468,294 Members | 1,911 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,294 developers. It's quick & easy.

System Clock!!!

3
heyy all,

can neone tel me how to get the timing showed by system clock
thanks
Nov 16 '06 #1
5 3926
sivadhas2006
142 100+
Hi,

You want to know the system time, right?

Regards,
M.Sivadhas.
Nov 16 '06 #2
aygarp
3
Hi,

You want to know the system time, right?

Regards,
M.Sivadhas.

yeah..i want to know the system time.....any ideas??
thanks
Nov 16 '06 #3
r035198x
13,262 8TB
Hi,

You want to know the system time, right?

Regards,
M.Sivadhas.
C version is
Expand|Select|Wrap|Line Numbers
  1.  
  2. #include <stdio.h>
  3.      #include <time.h>
  4.  
  5.      void main( )
  6.      {
  7.           char strDate [9];
  8.           char strTime [9];
  9.           _strdate( strDate);
  10.           printf( "The current date is %s \n", strDate);
  11.          _strtime( strTime);
  12.          printf( "The current time is %s \n", strTime);
  13.       }
  14.  
Nov 16 '06 #4
aygarp
3
C version is
Expand|Select|Wrap|Line Numbers
  1.  
  2. #include <stdio.h>
  3.      #include <time.h>
  4.  
  5.      void main( )
  6.      {
  7.           char strDate [9];
  8.           char strTime [9];
  9.           _strdate( strDate);
  10.           printf( "The current date is %s \n", strDate);
  11.          _strtime( strTime);
  12.          printf( "The current time is %s \n", strTime);
  13.       }
  14.  



thanks a lot......it really helped
Nov 20 '06 #5
baburk
111 100+
Hai aygarp

Use Port 0x70 & 0x71 BIOS port to get the time from BIOS

outport is used to send the port address and what we want to get.
inport is used to read the result that we send to outport.


#include <bios.h>

void main()
{
outportb(0x70,0x1);
printf("Seconds :%x",inportb(0x71));
outportb(0x70,0x2);
printf("Minutes:%x",inportb(0x71));
outportb(0x70,0x4);
printf("Hours :%x",inportb(0x71));
}


The result should be printed only in hexadecimal format.
Nov 22 '06 #6

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by James Harriman | last post: by
4 posts views Thread by Mario T. Lanza | last post: by
8 posts views Thread by eugene | last post: by
4 posts views Thread by Fritz89 | last post: by
4 posts views Thread by Dave | last post: by
12 posts views Thread by jUrner | last post: by
5 posts views Thread by Moikel | last post: by
3 posts views Thread by Carlos Lozano | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by Teichintx | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.