Changeset 1101


Ignore:
Timestamp:
Sep 8, 2012 10:30:30 AM (10 years ago)
Author:
jemian
Message:

report the UNIX timestamp, CA timestamp is more elusive, make sure only the new message is sent (not the continuing series of messages)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pvMail/src/PvMail/pvMail.py

    r1100 r1101  
    107107        self.old_value = None
    108108        self.monitoredPVs = []
     109        self.ca_timestamp = None
    109110   
    110111    def basicChecks(self):
     
    185186        if self.old_value == 0:
    186187            if value == 1:
     188                self.ca_timestamp = None
    187189                # Cannot use this definition:
    188190                #     self.trigger = (value == 1)
     
    190192                # to zero before SendMessage() runs.
    191193                self.trigger = True
     194                pv = epics._MONITORS_[self.triggerPV]
     195                self.ca_timestamp = pv.timestamp
     196                # or epics.ca.get_timestamp(pv.chid)
    192197                SendMessage(self)
    193198        self.old_value = value
     
    201206        message = ''
    202207        message += 'host: %s\n' % socket.gethostname()
    203         message += 'date: %s\n' % datetime.datetime.now()
     208        message += 'date: %s (UNIX, not PV)\n' % datetime.datetime.now()
    204209        message += 'program: %s\n' % sys.argv[0]
    205210        message += 'trigger PV: %s\n' % self.triggerPV
     
    226231            pvm.subject = "pvMail.py: " + pvm.triggerPV
    227232           
    228             msg = pvm.message
     233            #msg = pvm.message
     234            msg = ''        # start with a new message
    229235            msg += "\n\n"
    230236            msg += 'user: %s\n' % os.environ['LOGNAME']
    231237            msg += 'host: %s\n' % socket.gethostname()
    232             msg += 'date: %s\n' % datetime.datetime.now()
     238            msg += 'date: %s (UNIX, not PV)\n' % datetime.datetime.now()
     239            if pvm.ca_timestamp not in ('None', 0):
     240                msg += 'CA_timestamp: %d\n' % pvm.ca_timestamp
    233241            msg += 'program: %s\n' % sys.argv[0]
    234242            msg += 'PID: %d\n' % os.getpid()
Note: See TracChangeset for help on using the changeset viewer.