Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Embedded C#
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
 
Thanks
Vishal Jodh
Posted 5-Dec-12 20:28pm

1 solution

Rate this: bad
good
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.
  Permalink  
Comments
vishal jodh at 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 at 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:
http://miromannino.it/network-time-protocol-request-in-c/
If you read that, they can't change it, so your trial limitation will work.
vishal jodh at 6-Dec-12 6:22am
   
Thanks Sir for all
OriginalGriff at 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
0 OriginalGriff 587
1 Sergey Alexandrovich Kryukov 519
2 Maciej Los 305
3 BillWoodruff 250
4 Mathew Soji 195
0 OriginalGriff 7,356
1 Sergey Alexandrovich Kryukov 6,777
2 DamithSL 5,461
3 Manas Bhardwaj 4,916
4 Maciej Los 4,475


Advertise | Privacy | Mobile
Web03 | 2.8.1411023.1 | Last Updated 6 Dec 2012
Copyright © CodeProject, 1999-2014
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