private/Functions/Hanwha/Get-HanwhaDataTime.ps1

#https://$($ip)/stw-cgi/system.cgi?msubmenu=date&action=set&TimeZoneIndex=$($sitetimezone)&DSTEnable=True
#https://$($ip)/stw-cgi/system.cgi?msubmenu=date&action=set&SyncType=NTP&NTPURLList=$($NTPServerIp),time.nist.gov

Function Get-HanwhaDateTime {
    [cmdletBinding()]
    Param(
        [Parameter()]
        [hashtable]$Object
    )

    <#
    Object Definition:
    @{
        IP = [String(Mandatory)]
        Credential = [PSCredential(Mandatory)]
    }
    #>


    #Set basic Paramters for Invoke-HanwhaCommand
    $CamCmd = @{
        Arguments = @{
            IP = $Object.IP
            Menu = 'system'
            SubMenu = 'date'
            Action = 'view'
            Parameters = @()
        }
        Credential = $Object.Credential
    }

    $result = Invoke-HanwhaCommand @CamCmd

    $output = [ordered]@{
        LocalTime = $result.LocalTime

    }

    #Calculate Timezone
    $tz = $result.TimeZoneIndex
    if($result.DSTEnable) {
        $output.Add('TimeZone',$HanwhaTimeZoneIndexs["$($tz)D"])
    }
    else {
        $output.Add('TimeZone',$HanwhaTimeZoneIndexs["$($tz)S"])
    }

    #Calculate NTP Status
    if($result.SyncType -eq 'NTP') {
        $output.Add('NTPServers',$result.NTPURLList)
    }
    else {
        $output.Add('NTPServers','Disabled')
    }

    #Output
    return [pscustomobject]$output
}