예제 #1
0
 def setUp(self):
     self.th = TimeHelper.TimeUtil()
     pass
예제 #2
0
#
# You should have received a copy of the GNU Lesser General Public
# 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"
예제 #3
0
 def testKnownDate(self):
     '''getTimeStamp reports correct ACS timestamp for a known value'''
     rtn = TimeHelper.getTimeStamp()
     self.assertEqual(True, isinstance(rtn, acstime.Epoch))
     self.assertEqual(134270617899850370L, rtn.value)
예제 #4
0
#!/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()