Commit 5d2068f4 authored by Fin Maaß's avatar Fin Maaß Committed by Benjamin Cabé
Browse files

logging: log_output: move partly unused code



move code, that is only needed for one case
to that case.

Signed-off-by: default avatarFin Maaß <f.maass@vogl-electronic.com>
parent a9a475e5
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -163,19 +163,11 @@ static int timestamp_print(const struct log_output *output,
		uint64_t total_seconds;
#endif
		uint32_t remainder;
		uint32_t seconds;
		uint32_t hours;
		uint32_t mins;
		uint32_t ms;
		uint32_t us;

		timestamp /= timestamp_div;
		total_seconds = timestamp / freq;
		seconds = total_seconds;
		hours = seconds / 3600U;
		seconds -= hours * 3600U;
		mins = seconds / 60U;
		seconds -= mins * 60U;

		remainder = timestamp % freq;
		ms = (remainder * 1000U) / freq;
@@ -258,6 +250,15 @@ static int timestamp_print(const struct log_output *output,
#endif /* CONFIG_REQUIRES_FULL_LIBC */
#endif /* CONFIG_POSIX_C_LANG_SUPPORT_R */
			} else {
				uint32_t seconds;
				uint32_t hours;
				uint32_t mins;

				seconds = total_seconds;
				hours = seconds / 3600U;
				seconds -= hours * 3600U;
				mins = seconds / 60U;
				seconds -= mins * 60U;
				length = print_formatted(output,
							"[%02u:%02u:%02u.%03u,%03u] ",
							hours, mins, seconds, ms, us);