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

Updating The System Clock?

P: n/a
Greetings,

I am developing an app that utilizes a custom internet-based
replication process. Every record in my database has a DateAdded and
DateUpdated column to facilitate this. There are many satellite
locations and one master home office location whose database is
considered the master database.

I haven't run into any major issues yet. To further guarantee that I
will not, I want to have all satellites periodically via a web service
request the home office location's clock time.

Getting the home office clock time is easy -- I'll just use
DateTime.Now.

Once a satellite location acquires this info I need to update the
satellite machine's clock time. What is the .NET command for doing
this? I suspect the difficult of my finding this command deals with a
security issue...

Mario T. Lanza
Clarity Information Architecture, Inc.
Nov 22 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Hi Mario,

If you are using VB.NET, the Visual Basic Today function is
actually a Property which can be set - affecting the system date.
Similarly TimeOfDay will set the system clock.

I don't know what the Framework equivalent is, so if you're
using C# then you'd have to import Microsoft.VisualBasic.

Regards,
Fergus
Nov 22 '05 #2

P: n/a
> If you are using VB.NET, the Visual Basic Today function is
actually a Property which can be set - affecting the system date.
Similarly TimeOfDay will set the system clock.

I don't know what the Framework equivalent is, so if you're
using C# then you'd have to import Microsoft.VisualBasic.

Regards,
Fergus


Public Module Module1
Sub SetTimeOfDay(ByVal Time As String)
Dim NewTime As String = Date.Today.ToShortDateString() + " " + Time
Dim NewDate = Date.Parse(NewTime)
Today = NewDate
End Sub
End Module

From within my C# project I called the VB module...

Module1.SetTimeOfDay("10:50pm")

This did not work.

!?
Mario
Nov 22 '05 #3

P: n/a
Hi Mario,

|| If you are using VB.NET, the Visual Basic Today function is
|| actually a Property which can be set - affecting the system date.
|| Similarly <TimeOfDay> will set the system clock.

Your routine was setting the system date (Today) rather than the system clock
(TimeOfDay).

You've got a choice of two methods.

1) In your C# project add the following:
A reference to MS Visual Basic .NET Runtime.

a)
Microsoft.VisualBasic.DateAndTime.TimeOfDay
= DateTime.Parse (sSomeTimeString);

b)
using VB = Microsoft.VisualBasic;

VB.DateAndTime.TimeOfDay = DateTime.Parse (sSomeTimeString);

2) In your VB project use

Public Module Module1
Sub SetTimeOfDay(ByVal NewTime As String)
TimeOfDay = DateTime.Parse(NewTime)
End Sub
End Module

Regards,
Fergus
Nov 22 '05 #4

P: n/a
Thanks Fergus.
Got it working!

Mario
Nov 22 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.