<commit_before>﻿Imports System.IO
Imports System.Net.Sockets
Imports System.Globalization

Public Class GRCDiagnostics

    Public Function GetNISTDateTime() As DateTime
        Try

            Dim sNISTHOST As String = "time-nw.nist.gov" 'Atomic Clock Time Server in UTC
            Dim client = New TcpClient(sNISTHOST, 13)
            Dim localDateTime As DateTime

            Using streamReader = New StreamReader(client.GetStream())
                Dim response = streamReader.ReadToEnd()
                Dim utcDateTimeString = response.Substring(7, 17)
                '57551 16-06-12 16:57:53 50 0 0 353.8 UTC(NIST)
                Dim sChopped As String = Mid(response, 7, 100)
                sChopped = Replace(sChopped, "(NIST) *", "")
                sChopped = Trim(Left(sChopped, 18))
                sChopped += " UTC"
                Dim sYear As String = "20" + Mid(sChopped, 1, 2)
                Dim sMonth As String = Mid(sChopped, 4, 2)
                Dim sDay As String = Mid(sChopped, 7, 2)
                Dim sHour As String = Mid(sChopped, 10, 2)
                Dim sMinute As String = Mid(sChopped, 13, 2)
                Dim sSecond As String = Mid(sChopped, 16, 2)
                localDateTime = New Date(Val(sYear), Val(sMonth), Val(sDay), Val(sHour), Val(sMinute), Val(sSecond))
            End Using
        Return localDateTime
        Catch ex As Exception
            Return CDate("1-1-1970")<commit_msg>Change broken timeserver to pool.ntp.org.<commit_after>﻿Imports System.IO
Imports System.Net.Sockets
Imports System.Globalization

Public Class GRCDiagnostics

    Public Function GetNISTDateTime() As DateTime
        Try

            Dim sNISTHOST As String = "pool.ntp.org" 'Atomic Clock Time Server in UTC
            Dim client = New TcpClient(sNISTHOST, 13)
            Dim localDateTime As DateTime

            Using streamReader = New StreamReader(client.GetStream())
                Dim response = streamReader.ReadToEnd()
                Dim utcDateTimeString = response.Substring(7, 17)
                '57551 16-06-12 16:57:53 50 0 0 353.8 UTC(NIST)
                Dim sChopped As String = Mid(response, 7, 100)
                sChopped = Replace(sChopped, "(NIST) *", "")
                sChopped = Trim(Left(sChopped, 18))
                sChopped += " UTC"
                Dim sYear As String = "20" + Mid(sChopped, 1, 2)
                Dim sMonth As String = Mid(sChopped, 4, 2)
                Dim sDay As String = Mid(sChopped, 7, 2)
                Dim sHour As String = Mid(sChopped, 10, 2)
                Dim sMinute As String = Mid(sChopped, 13, 2)
                Dim sSecond As String = Mid(sChopped, 16, 2)
                localDateTime = New Date(Val(sYear), Val(sMonth), Val(sDay), Val(sHour), Val(sMinute), Val(sSecond))
            End Using
        Return localDateTime
        Catch ex As Exception
            Return CDate("1-1-1970")
{'fraction_non_alphanumeric': 0.08991077556623199, 'fraction_numerical': 0.04049416609471517, 'mean_word_length': 1.941473259334006, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1683336', 'n_tokens_mistral': 1003, 'n_tokens_neox': 846, 'n_words': 263}