Simple little ruby code for getting epoch time
Posted: Mon Mar 18, 2013 7:41 pm
I need to send out unix time to a micro and it seems easy to get windows epoch time using the ruby command and then do basic maths to convert to unix time-- I am still getting used to the ruby module in flowstone- I wrote this little piece of code which outputs the time in seconds but it is not updating the time each time I trigger the module- What am I doing wrong? The module is connected by a single trigger in and a single int out.
def event(in_id,value) # Input Events
case in_id
when 0 # update value
time = (Time.now.to_f * 1000.0).to_i
output 0, time
end
end
Thanks
Quentin
def event(in_id,value) # Input Events
case in_id
when 0 # update value
time = (Time.now.to_f * 1000.0).to_i
output 0, time
end
end
Thanks
Quentin