Solved

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

Posted on 2006-06-10
1
1,779 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
1 Comment
 
LVL 5

Accepted Solution

by:
aaronfeng earned 500 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Exception in Log4Net 1 20
Chat Room 1 30
Get String split 5 33
Installing IIS after Visual Studio 2015 Community Edition 5 18
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…
Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

743 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now