From: Lukas Jiriste Date: Thu, 9 May 2024 09:00:54 +0000 (+0200) Subject: Fix discrepancy caused by confusing ms and us X-Git-Url: https://git.ljiriste.work/?a=commitdiff_plain;h=f79386d638f12a30749a887967b17fb444011c3d;p=42%2Fphilosophers.git Fix discrepancy caused by confusing ms and us --- diff --git a/philo/helpers.c b/philo/helpers.c index 09b71c6..05f3f05 100644 --- a/philo/helpers.c +++ b/philo/helpers.c @@ -1,12 +1,12 @@ /* ************************************************************************** */ /* */ /* ::: :::::::: */ -/* philo_helpers.c :+: :+: :+: */ +/* helpers.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: ljiriste +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/05/09 09:13:40 by ljiriste #+# #+# */ -/* Updated: 2024/05/09 10:16:19 by ljiriste ### ########.fr */ +/* Updated: 2024/05/09 10:39:16 by ljiriste ### ########.fr */ /* */ /* ************************************************************************** */ @@ -35,7 +35,7 @@ useconds_t usecs_since_start(struct timeval start) void print_timestamp(t_philo *philo, const char *str) { mutex_lock(&philo->settings->terminal_lock); - printf("%u %lu %s\n", usecs_since_start(philo->settings->start), philo->id, str); + printf("%u %lu %s\n", usecs_since_start(philo->settings->start) / 1000 , philo->id, str); mutex_unlock(&philo->settings->terminal_lock); return ; } diff --git a/philo/pars_arg.c b/philo/pars_arg.c index 8c44809..c9b7986 100644 --- a/philo/pars_arg.c +++ b/philo/pars_arg.c @@ -6,7 +6,7 @@ /* By: ljiriste +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/03/28 11:29:47 by ljiriste #+# #+# */ -/* Updated: 2024/03/28 11:36:24 by ljiriste ### ########.fr */ +/* Updated: 2024/05/09 10:38:14 by ljiriste ### ########.fr */ /* */ /* ************************************************************************** */ @@ -20,6 +20,7 @@ int parse_arg_usec(useconds_t *res, const char *arg) if (inner_parse_arg(&tmp, arg)) return (1); + tmp *= 1000; if (tmp > (useconds_t)-1) return (1); *res = (useconds_t)tmp;