Fix discrepancy caused by confusing ms and us
authorLukas Jiriste <ljiriste@student.42prague.com>
Thu, 9 May 2024 09:00:54 +0000 (11:00 +0200)
committerLukas Jiriste <ljiriste@student.42prague.com>
Thu, 9 May 2024 09:00:54 +0000 (11:00 +0200)
philo/helpers.c
philo/pars_arg.c

index 09b71c63886c3f6b9ae493a7dd05f076b88cc4be..05f3f05482046f09ab30d39fe71118234e79869b 100644 (file)
@@ -1,12 +1,12 @@
 /* ************************************************************************** */
 /*                                                                            */
 /*                                                        :::      ::::::::   */
-/*   philo_helpers.c                                    :+:      :+:    :+:   */
+/*   helpers.c                                          :+:      :+:    :+:   */
 /*                                                    +:+ +:+         +:+     */
 /*   By: ljiriste <marvin@42.fr>                    +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   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 ;
 }
index 8c44809d471e3c189ae79feff9b428df41827d24..c9b79867399b597b21a5831589e8319530198f0d 100644 (file)
@@ -6,7 +6,7 @@
 /*   By: ljiriste <marvin@42.fr>                    +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   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;