Author Arfrever
Recipients Alexander.Belopolsky, Arfrever, belopolsky, ericography, jcea, khenriksson, larry, lars.gustaebel, loewis, mark.dickinson, nadeem.vawda, r.david.murray, rhettinger, rosslagerwall, skrah, vstinner
Date 2012-01-24.14:56:25
SpamBayes Score 0.059422
Marked as misclassified No
Message-id <1327416986.5.0.999379525719.issue11457@psf.upfronthosting.co.za>
In-reply-to
Content
st_atim, st_ctim and st_mtim attributes could be instances of a class (implemented in posixmodule.c) similar to:

class timespec(tuple):
    def __init__(self, arg):
        if not isinstance(arg, tuple):
            raise TypeError
        if len(arg) != 2:
            raise TypeError
        if not isinstance(arg[0], int):
            raise TypeError
        if not isinstance(arg[1], int):
            raise TypeError
        self.sec = arg[0]
        self.nsec = arg[1]
        tuple.__init__(self)
    def __add__(self, other):
        if not isinstance(other, timespec):
            raise TypeError
        ns_sum = (self.sec * 10 ** 9 + self.nsec) + (other.sec * 10 ** 9 + other.nsec)
        return timespec(divmod(ns_sum, 10 ** 9))
    def __sub__(self, other):
        if not isinstance(other, timespec):
            raise TypeError
        ns_diff = (self.sec * 10 ** 9 + self.nsec) - (other.sec * 10 ** 9 + other.nsec)
        return timespec(divmod(ns_diff, 10 ** 9))
History
Date User Action Args
2012-01-24 14:56:26Arfreversetrecipients: + Arfrever, loewis, rhettinger, jcea, mark.dickinson, belopolsky, lars.gustaebel, vstinner, larry, nadeem.vawda, r.david.murray, skrah, Alexander.Belopolsky, rosslagerwall, khenriksson, ericography
2012-01-24 14:56:26Arfreversetmessageid: <1327416986.5.0.999379525719.issue11457@psf.upfronthosting.co.za>
2012-01-24 14:56:25Arfreverlinkissue11457 messages
2012-01-24 14:56:25Arfrevercreate