2
# Run in a user's jail to test the "short date format" displayed in the
3
# file browser's file table.
5
# Generates a bunch of files in the current directory and sets their date
6
# stamps to various dates in the past.
7
# The files are named after their date stamps relative to today.
15
seconds_per_day = 60*60*24
16
time_now = time.time()
19
timezone_offset = time.altzone
21
timezone_offset = time.timezone
23
# Time at the beginning of today, local time
25
= time_now - int(time_now - timezone_offset) % seconds_per_day
27
def make_file_days_ago(days_ago):
29
make_file(str(days_ago) + "days",
30
time_now - seconds_per_day*days_ago)
31
def make_file(fname, timestamp):
34
os.utime(fname, (timestamp, timestamp))
44
make_file_days_ago(10)
45
make_file_days_ago(365)
47
# Now a boundary test - Make a file in the last second of Yesterday.
48
make_file("first_second_today", local_daystart)
49
make_file("last_second_yesterday", local_daystart-1)