07-27-2018 09:37 AM
Hi Group,
Working on a Dataplugin, (little rusty at this!)
Try to take a binary file, that has Seconds since 1904 in 64 bit real, and create a Time channel that shows the time in the data portal.
Input:
3522074457.314985
Output
8/15/2015 18:00:57.3150 when viewed in portal for time channel format.
Function that works just fine, but alas is not available as Dataplugin command!
dim oChn: set oChn = data.root.channelgroups(1).Channels("Time")
ChnNumericToTime(oChn,TTR("1904-01-01 00:00:00 ,0","yyyy-mm-dd hh:mm:ss,ffff",true)
What is not clear to me is how to do this conversion from input to output from a dataplugin environment.
Any help would be appreciated.
Thanks again,
Paul
Solved! Go to Solution.
07-27-2018 12:10 PM
Note:
Am using DIAdem 2018, On Windows 7-64 machine.
Paul
			
    
	
		
		
		07-30-2018
	
		
		04:16 PM
	
	
	
	
	
	
	
	
	
	
	
	
	
	
 - last edited on 
    
	
		
		
		11-15-2024
	
		
		05:41 PM
	
	
	
	
	
	
	
	
	
	
	
	
	
	
 by 
				
		
		
			Content Cleaner
		
		
		
		
		
		
		
		
	
			
		
Hey Paul,
Not sure if you've seen the resources for making custom DataPlugins but I figured I'd include them just in case.
(Resources for Writing Your Own DataPlugin)
https://www.ni.com/en/support/downloads/dataplugins/resources-for-writing-your-own-dataplugin.html
If you have the function made but cannot see it in DIAdem, you might need to register the DataPlugin.
(Registering DataPlugins)
08-06-2018 02:34 AM
The dataplugins allow you to set an offset on time channels starting with DIAdem 2015.
The given example will show the content of the plugin to use the offset.
I attached the file containing your double value.
Option Explicit
const SECONDS_1_JANUARY_1904 = 60084288000
const SECONDS_1_JANUARY_1970 = 62167132800
const SECONDS_1_JANUARY_1601 = 50522659200
Sub ReadStore(File)
  Dim Block : Set Block = File.GetBinaryBlock()
  ' Use direct access channel including offset for seconds
  Dim DirectAccessChannel : Set DirectAccessChannel = Block.Channels.Add("TimeChannelWithOffset", eR64)
  DirectAccessChannel.Factor = 1.0
  DirectAccessChannel.Offset = SECONDS_1_JANUARY_1904
  
  Dim ChannelGroup : Set ChannelGroup = Root.ChannelGroups.Add("group")
  dim channel : set channel = ChannelGroup.Channels.AddDirectAccessChannel(DirectAccessChannel)
  call channel.Properties.Add("displaytype", "Time")
End Sub