Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4097004
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T20:07:06+00:00 2026-05-20T20:07:06+00:00

I am working on a business related program, so I need to know if

  • 0

I am working on a business related program, so I need to know if system date is correct -synced- with remote server. How do you do that in vb .NET winforms?

P.S: In addition, is there any way to raise some event when system clock changed to prevent hacks? I don’t want users to change local date after logging in their account.

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T20:07:06+00:00Added an answer on May 20, 2026 at 8:07 pm

    You will need to verify the clock with an external server and accept it if it is within a certain tolerance. All clocks are wrong by some degree. Usually a webservice on a server somewhere is enough, but there are many free NTP-services. Note however it would take me 5 minutes to bypass that, so for more security you need to use SSL (HTTPS) (makes man-in-the-middle attacks impossible).

    Note however:

    • You need to compensate correctly for timezones as server and users could have different timezones. Timezone info is sent in ISO 8601 formatted DateTime string, so thats easy enough.
    • What is preventing user from disconnecting internet? Do you really want to require internet access to start the app? Someone with a laptop would quickly discover that offline mode makes the app work.
    • One technique used by some is to say that if a time in the future (after product has expired) has been spotted by the app then you need to reactivate it. Reactivation requires communication with internet server which can verify the license against a trusted clock.

    If you want to know when a user changes the clock simply set up a thread to loop with a 60 second Thread.Sleep(60000). Then check current DateTime against the one 60 seconds ago. It should always be 60 seconds -/+ 1 seconds since last check. (+/- 1 second is to compensate for delays like app hanging slightly as timer is executing, etc)

    I threw together a quick example:
    EDIT: Sorry, first sample was in C#. Redone it in VB.Net.

    Imports System.Threading
    
    Public Class Form1
        Private TimeMonitorThread As Thread
    
        Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
            TimeMonitorThread = New Thread(TimeMonitorThreadLoop)
            TimeMonitorThread.Name = "TimeMonitorThread"
            TimeMonitorThread.IsBackground = True
            TimeMonitorThread.Start()
    
        End Sub
    
        Private Sub TimeMonitorThreadLoop()
    
            Dim sleepSeconds As Integer = 60
            Dim tolerance As Integer = 1
    
            While (True)
                Dim before As DateTime = DateTime.Now
                Thread.Sleep(sleepSeconds * 1000)
                Dim after As DateTime = DateTime.Now
                If (Math.Abs(CInt(after.Subtract(before).TotalSeconds) - sleepSeconds) > tolerance) Then
                    ' Time has changed!
                End If
            End While
        End Sub
    
    End Class
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a large Winforms project for a client that is using business
I'm working on a program that does OCR on a US business card and
I am working with some business objects that relate to one another through their
I am working on a business problem in C#.NET. I have two classes, named
Background I am working on a legacy small-business automation system (inventory, sales, procurement, etc.)
I am currently working on a module that takes one of our business objects
I am working on maintaining an ASP.NET website, and I've noticed the business layer
I'm working on some application, that uses a TreeView control to represent business objects.
It's not code-related but IDE related. I'm working on a .NET solution with about
I have several business rules for my FormPartB object that depend on related entities

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.