def __parse_starting_point()

in eventdata/parameter_sources/timeutils.py [0:0]


    def __parse_starting_point(self, point):
        if point == "now":
            # this is "now" at this point
            return self._start
        else:
            match = re.match(r"^(\d{4})\D(\d{2})\D(\d{2})\D(\d{2})\D(\d{2})\D(\d{2})$", point)
            if match:
                return datetime.datetime(year=int(match.group(1)),
                                         month=int(match.group(2)),
                                         day=int(match.group(3)),
                                         hour=int(match.group(4)),
                                         minute=int(match.group(5)),
                                         second=int(match.group(6)),
                                         tzinfo=datetime.timezone.utc)
            else:
                match = re.match(r"^(\d{4})\D(\d{2})\D(\d{2})$", point)
                if match:
                    return datetime.datetime(year=int(match.group(1)),
                                             month=int(match.group(2)),
                                             day=int(match.group(3)),
                                             tzinfo=datetime.timezone.utc)

        raise TimeParsingError("Invalid time format: {}".format(point))