Example #1
0
File: fs.py Project: tstein/journal
def getentrypath(date):
    """ Create the absolute path where the entry for date should go. """
    base = path.expanduser(getconf('entry_dir'))
    yearstr = str(date.year)
    monthstr = "%02d" % date.month
    daystr = "%02d" % date.day
    basename = "%s.txt" % daystr
    return path.join(base, yearstr, monthstr, basename)
Example #2
0
def getentrypath(date):
    """ Create the absolute path where the entry for date should go. """
    base = path.expanduser(getconf('entry_dir'))
    yearstr = str(date.year)
    monthstr = "%02d" % date.month
    daystr = "%02d" % date.day
    basename = "%s.txt" % daystr
    return path.join(base, yearstr, monthstr, basename)
Example #3
0
def getdate(when_secs):
    """ Return the time given as a string that parsedate will understand.

    Each day lasts until the hour reaches getconf('end_of_day'). e.g., If the
    day ends at 5 and it is 04:00 on 2012-04-08, this function will return
    2012-04-07. """
    end_of_day = getconf('end_of_day')
    when = localtime(when_secs - (60 * 60 * end_of_day))
    year = when.tm_year
    month = when.tm_mon
    day = when.tm_mday
    return "%04d-%02d-%02d" % (year, month, day)
Example #4
0
def getdate(when_secs):
    """ Return the time given as a string that parsedate will understand.

    Each day lasts until the hour reaches getconf('end_of_day'). e.g., If the
    day ends at 5 and it is 04:00 on 2012-04-08, this function will return
    2012-04-07. """
    end_of_day = getconf('end_of_day')
    when = localtime(when_secs - (60 * 60 * end_of_day))
    year = when.tm_year
    month = when.tm_mon
    day = when.tm_mday
    return "%04d-%02d-%02d" % (year, month, day)