Just yesterday (2002), the DeltaV application exchange https://deltav.com/Appsnew/ once had an Excel spreadsheet supplied by Daryl Coates that would parse the .imp files that are used for DeltaV uploads. The application exchange has not been maintained and for the current state of Cyber Security exploits, it would probably not be prudent to do so.
Most of the .imp file is self explanatory, but the time stamp was not obvious.
The Excel VBA code to decode the date / time stamp into Excel date / time is as follows:
lng_gmtoffset = 0
' Timestamps seem to be worked from a base of 1-jan-1972lng_1972 = 26299' This appears to be the divisor to get seconds from the timestamp fieldlng_division = 32000
' Convert hex timestamp (seconds since 1972) ' to excel date format (days since 1900) ' Calculate part by part to stop numeric overflows and ' to make the process clearer dbl_date = UnHex(str_stamp) dbl_date = dbl_date / lng_division 'seconds dbl_date = dbl_date / (60# * 60# * 24#) 'days dbl_date = dbl_date + lng_1972 ' since 1972 dbl_date = dbl_date + (lng_gmtoffset / 24#)
Function UnHex(ByVal str_hex As String) As Double
'' UnHex function' Written 10/2/02 by Daryl Coates to return a double value' from a large hexadecimal string'
Dim dbl_result As DoubleDim str_hexstring As String
dbl_result = 0str_hexstring = "0123456789ABCDEF"
' Scan through each character right to left, multiply by 16 for each characterDo dbl_result = dbl_result * 16 dbl_result = dbl_result + (InStr(1, str_hexstring, Left(str_hex, 1), 1) - 1) str_hex = Right(str_hex, Len(str_hex) - 1) Loop While str_hex <> ""
UnHex = dbl_resultEnd Function
This supplied as is, explicitly no support implied. Use at your own discretion.
I found the Excel VBA implementation would often fail on insufficient memory in systems with high node counts or a lot of un-uploaded changes. This is a PowerShell implementation that may be more appropriate for those cases.
To quote Randy, this supplied as is, explicitly no support implied. Use at your own discretion.
## === Variables === ## $files = get-childitem -Recurse "D:\DeltaV\DVDATA\*.imp" $header = "Parameter","Field","Raw Datestamp","New Value","Username" $hash = @() $utcOffset = -5 $Timestamp = Get-Date -Format "yyyyMMdd_HHmmss" $CsvReport = ".\BetterPowerup_$Timestamp.csv" ## === Variables === ## foreach ($file in $files) { $module = $file.BaseName.trimstart("_") $module_contents = import-csv -Delimiter "`t" -Path $file -Header $header $ctlrPath = $file.DirectoryName+"\STARTDEV.STE" $ctlrName = (Get-Content $ctlrPath)[3].TrimStart("TG='").TrimEnd("'") for ($line = 0; $line -le ($module_contents.Length - 1); $line++ ) { # Date/time is encoded as a 64-bit hexadecimal. [uint64]$rawDatestamp = "0x"+$module_contents[$line].'Raw Datestamp' # Conversion to seconds with UTC offset $elapsedSeconds=$rawDateStamp / 32000 + $utcOffset * 60 * 60 # Unlike the rest of the universe, the controller floor date is 1/1/1972. [datetime]$finalDate = ([datetime]'1/1/1972').AddSeconds($elapsedSeconds) # Assemble all the fields for this row. $Object = New-Object PSObject -Property @{ 'Controller' = $ctlrName 'Module' = $module 'Parameter' = $module_contents[$line].parameter 'Field' = $module_contents[$line].field 'Datestamp' = $finalDate 'New Value' = $module_contents[$line].'New Value' 'Username' = $module_contents[$line].Username } # End $object # Append this row to the overall hash table. $hash += $object } # End foreach $line } # End foreach $file $hash | Export-Csv -Path $CsvReport -NoTypeInformation -Encoding UTF8
In reply to Ray Emerson: