# License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, # MA 02111-1307 USA # # @(#) $Id: acspyTestTimehelper.py,v 1.1.1.1 2012/03/07 17:40:45 acaproni Exp $ ############################################################################### ''' Tests the Python Time System. ''' ############################################################################### import acstime from Acspy.Common import TimeHelper print "getTimeStamp is:", TimeHelper.getTimeStamp() obj = TimeHelper.TimeUtil() print "January 1, 1970 is:", obj.py2epoch(0).value, " in ACS time" print "January 1, 1970 is:", obj.epoch2py(acstime.Epoch( obj.py2epoch(0).value)), " in Python time" print "October 15, 1582 is:", obj.py2epoch(obj.epoch2py( acstime.Epoch(0))).value, " in ACS time" print "October 15, 1582 is:", obj.epoch2py(acstime.Epoch(0)), " in Python time" print "1000 seconds is:", obj.py2duration(1000).value, " in ACS time" print "1000 seconds is:", obj.duration2py( acstime.Duration(obj.py2duration(1000).value)), " in Python time"
def setUp(self): self.th = TimeHelper.TimeUtil() pass
#!/usr/bin/env python from Acspy.Clients.SimpleClient import PySimpleClient from Acspy.Common.Err import ACSError from Acspy.Common import TimeHelper from Acspy.Nc.Supplier import Supplier from time import sleep, time import bulkdata c = PySimpleClient() supplier = Supplier(bulkdata.CHANNELNAME_ERR_PROP) #print bulkdata.BAD_SENDER #print bulkdata.BAD_RECEIVER #print bulkdata.OK print "I will send events ..." flow = "00" for x in range(0, 10000): timestamp = TimeHelper.TimeUtil().epoch2py(TimeHelper.getTimeStamp()) h = bulkdata.errorStatusBlock(flow, bulkdata.BAD_RECEIVER, timestamp) # if x % 2 == 0: # h.status = bulkdata.OK supplier.publishEvent(h) sleep(0.1) print(x, h) supplier.disconnect()