diff --git a/analyze.py b/analyze.py index 9ffc63d..288a5c5 100644 --- a/analyze.py +++ b/analyze.py @@ -99,14 +99,14 @@ def analyze_server(server: Path, serverip: str) -> None: time_of_hit = datetime.strptime(timethings, log_date_format) # convert from its default timezone in GMT to the timezone of the requester localtime = time_of_hit.replace(tzinfo=timezone.utc).astimezone(timezone) - # convert this time back to a string for logging purposes - localtime_str = localtime.strftime(log_date_format) + # convert this time back to a string for logging purposes, without timezone + localtime_str = ' '.join(localtime.strftime(log_date_format).split(' ')[:2]) distance = latlon_distance(self_latlon, latlon) date, time = timethings.split(' ')[:2] result += ( - f'{server.name},{ip},{distance},{date},{time},' - + f'{localtime_str},{method},{file}\n' + f'{server.name},{ip},{distance:.5f},{date},{time},' + + f'{localtime_str},{method},"{file}"\n' ) return result @@ -135,7 +135,7 @@ def main(args: list) -> int: outfile = 'analysis.csv' start_dir = Path('.').resolve() - f = open(outfile, 'a') + f = open(outfile, 'w') for logdir in args[1:]: chdir(logdir) serverdir = Path('.')