@classmethod
def from_nanoseconds(cls, nsec):
    """
        Returns the closest pointwidth for the given number of nanoseconds without going
        over the specified duration. Because pointwidths are in powers of 2, be sure to
        check that the returned real duration is sufficient.
        """
    for pos in range(62):
        nsec = nsec >> 1
        if nsec == 0:
            break
    return cls(pos)
