def convertClock(self,place,clock,date):
        clo = clock[:-2]
        min = clo[-2:]
        hour = clo[:-3]
        val = (int(hour)*60) + int(min)
        per = clock[-2:]
        if per=='pm':
            if int(hour) < 12:
                val = val + 12*60
        elif per == 'am':
            if int(hour) >= 12:
                val = val - 12*60

        # yahoo return EDT OR EST time
        eastern = timezone('US/Eastern')
        mdatetime = datetime(int(date[0:4]),int(date[4:6]),int(date[6:8]),val/60,val%60)
        loc_dt = eastern.localize(mdatetime)
        if str(loc_dt.strftime('%Z')) == 'EDT':
            val = val-60
            if val <= 0:
                val = (12*60)-60
                
        #print clock,clo,hour,min,val,per,date

        if val>self.m_lastclock and date>=self.m_lastdate:
            self.m_lastdate = date
            self.m_lastclock = val

        # convert from connector timezone to market place timezone
        mdatetime = datetime(int(date[0:4]),int(date[4:6]),int(date[6:8]),val/60,val%60)
        mdatetime = convertConnectorTimeToPlaceTime(mdatetime,self.timezone(),place)
        return "%d:%02d" % (mdatetime.hour,mdatetime.minute)
    def convertClock(self, place, clock, date):
        clo = clock[:-2]
        min = clo[-2:]
        hour = clo[:-3]
        val = (int(hour) * 60) + int(min)
        per = clock[-2:]
        if per == 'pm':
            if int(hour) < 12:
                val = val + 12 * 60
        elif per == 'am':
            if int(hour) >= 12:
                val = val - 12 * 60

        # yahoo return EDT OR EST time
        eastern = timezone('US/Eastern')
        mdatetime = datetime(int(date[0:4]), int(date[4:6]), int(date[6:8]),
                             val / 60, val % 60)
        loc_dt = eastern.localize(mdatetime)
        if str(loc_dt.strftime('%Z')) == 'EDT':
            val = val - 60
            if val <= 0:
                val = (12 * 60) - 60

        #print clock,clo,hour,min,val,per,date

        if val > self.m_lastclock and date >= self.m_lastdate:
            self.m_lastdate = date
            self.m_lastclock = val

        # convert from connector timezone to market place timezone
        mdatetime = datetime(int(date[0:4]), int(date[4:6]), int(date[6:8]),
                             val / 60, val % 60)
        mdatetime = convertConnectorTimeToPlaceTime(mdatetime, self.timezone(),
                                                    place)
        return "%d:%02d" % (mdatetime.hour, mdatetime.minute)
    def convertClock(self,place,clock,date):
        min = clock[-2:]
        hour = clock[:-3]
        val = (int(hour)*60) + int(min)

        if val>self.m_lastclock and date>=self.m_lastdate:
            self.m_lastdate = date
            self.m_lastclock = val

        # convert from connector timezone to market place timezone
        mdatetime = datetime(int(date[0:4]),int(date[4:6]),int(date[6:8]),val/60,val%60)
        mdatetime = convertConnectorTimeToPlaceTime(mdatetime,self.timezone(),place)
        return "%d:%02d" % (mdatetime.hour,mdatetime.minute)
Ejemplo n.º 4
0
    def convertClock(self, place, clock, date):
        min = clock[-2:]
        hour = clock[:-3]
        val = (int(hour) * 60) + int(min)

        if val > self.m_lastclock and date >= self.m_lastdate:
            self.m_lastdate = date
            self.m_lastclock = val

        # convert from connector timezone to market place timezone
        mdatetime = datetime(int(date[0:4]), int(date[4:6]), int(date[6:8]),
                             val / 60, val % 60)
        mdatetime = convertConnectorTimeToPlaceTime(mdatetime, self.timezone(),
                                                    place)
        return "%d:%02d" % (mdatetime.hour, mdatetime.minute)