?
Solved

How to override DateTime.Now to get date and time from the internet

Posted on 2006-06-10
1
Medium Priority
?
1,968 Views
Last Modified: 2008-03-10
Hello... I want to  override DateTime.Now to get date and time from the internet, preferrably atomic time.  I haven't a clue where to start.  Can someone point me in the right direction?

Thanks...
0
Comment
Question by:rmmarsh
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 5

Accepted Solution

by:
aaronfeng earned 2000 total points
ID: 16877990
DateTime class is a sealed class, so it means you can't inherit and override any functions.  What you can do is to create your own custom DateTime class.  If you want the time from the Internet, you need a way to synchronize with the NTP servers which means you'll have to create a client that connects to the servers.  Here is an example: http://www.codeproject.com/cs/internet/ntpclient.asp  If you dig around codeproject I'm sure there are other examples.

Cheers,

Aaron
http://geekswithblogs.net/afeng
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question