By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,604 Members | 1,414 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,604 IT Pros & Developers. It's quick & easy.

System Clock!!!

P: 3
heyy all,

can neone tel me how to get the timing showed by system clock
thanks
Nov 16 '06 #1
Share this Question
Share on Google+
5 Replies


sivadhas2006
100+
P: 142
Hi,

You want to know the system time, right?

Regards,
M.Sivadhas.
Nov 16 '06 #2

P: 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

10K+
P: 13,264
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

P: 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

100+
P: 111
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.