Click here to Skip to main content
13,140,231 members (47,755 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Hey everyone

My first question is that, can c# lang communicate with motherboard component. Like RTC(Read Time Clock) Module, if yes Then tell me How can i getting the Date and Time from RTC Module so that if System time is change my application running with correct time.

If any one know about this pls help as soon as possible

Vishal Jodh
Posted 5-Dec-12 19:28pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

I'm not sure you can in modern OS's such as Win7 and above - they do tend to isolate you from the hardware as much as possible and forbid "Normal" privilege applications from touching it in any way.

But you don't need to anyway - just use the .NET components: DateTime.Now tells you the time right now - if the system time changes, so will the value it returns, because it reads the system time each time you call it.
vishal jodh 6-Dec-12 5:00am
Thanks sir

But actually Now i am working on License key Generator project so My application calculate days, but in case some one changed system date and time then it will failed. so that's why, i am developing Calender(Date & Time) Windows Service App so that my application getting Date and Time from my own Service. if u know any idea regarding this issue pls tell.
OriginalGriff 6-Dec-12 5:35am
Won't make any difference - your code cannot detect the change unless it is running at the time. Remember that when you power a PC up, you can enter the CMOS setup of the BIOS directly, and set the date and time there. Your code cannot be running at that time, so it cannot detect the change when it happens.

There are two things you can do:
1) Save the last date and time to disk, and check against it to see if it has moved back significantly (remember to allow for Summer / Winter clock changes, and also time corrections). Don't save too often though, as you will annoy people who have bought the product and do not want the HDD accessed all the time.
2) Read the actual UTC time from an internet time controller - this can help:
If you read that, they can't change it, so your trial limitation will work.
vishal jodh 6-Dec-12 6:22am
Thanks Sir for all
OriginalGriff 6-Dec-12 6:38am
You're welcome!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.170915.1 | Last Updated 6 Dec 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100