change times to unix time

master
Volkor 7 months ago
parent 95a1e19d29
commit 67c111ee56
No known key found for this signature in database
GPG Key ID: BAD7CA8A81CC2DA5
  1. 7
      QuadFile/db.py
  2. 2
      run.py

@ -207,7 +207,9 @@ def longest_deletiontime():
if not rv:
return 0
db.close()
return rv
print(rv)
deletiontime = datetime.strptime(rv, '%Y-%m-%d %H:%M:%S.%f')
return deletiontime.timestamp()
def average_deletiontime():
db = connect('files.db')
@ -225,7 +227,8 @@ def average_deletiontime():
# Likely not the fastest, but take the difference from reference, and sum, avg the difference
# then add the avg to the reference date https://stackoverflow.com/questions/19681703/average-time-for-datetime-list
reference_date = datetime(1900, 1, 1)
return reference_date + sum([date - reference_date for date in dates], timedelta()) / len(dates)
avg = reference_date + sum([date - reference_date for date in dates], timedelta()) / len(dates)
return avg.timestamp()
### File Deletion time per filetype (avg file deletion time on filetype)

@ -141,7 +141,6 @@ def generateMetrics():
# Total File Sizes by Type
filenames = db.list_totalfiletypes()
print(filenames)
for extension in filenames:
for size in db.list_totalsizes(extension):
if not size: # Return 0 instead of NoneType
@ -265,7 +264,6 @@ def upload_file():
else:
deletiontime = time.time() + config["TIME"]
deletiontime = datetime.fromtimestamp(deletiontime)
print(deletiontime)
db.add_deletiontime(deletiontime, filename)
print_log('Main', 'New file processed "' + filename + '"')

Loading…
Cancel
Save