mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-26 15:02:50 +02:00
eitd/debug.cpp: Fix format specifiers for platform independence
- Changed format specifier from %ld to %" PRId64 " for variables
of type `__suseconds64_t` to ensure cross-platform compatibility.
- Added casts to `int64_t` for accurate formatting.
- Included `<cinttypes>` for proper format macros.
This should avoid format warnings and ensure correct behavior
on systems where `__suseconds64_t` and similar types are 64-bit integers.
Origin commit data
------------------
Branch: ni/coolstream
Commit: d7841d9654
Author: Thilo Graf <dbt@novatux.de>
Date: 2024-09-02 (Mon, 02 Sep 2024)
Origin message was:
------------------
eitd/debug.cpp: Fix format specifiers for platform independence
- Changed format specifier from %ld to %" PRId64 " for variables
of type `__suseconds64_t` to ensure cross-platform compatibility.
- Added casts to `int64_t` for accurate formatting.
- Included `<cinttypes>` for proper format macros.
This should avoid format warnings and ensure correct behavior
on systems where `__suseconds64_t` and similar types are 64-bit integers.
------------------
This commit was generated by Migit
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#include <cinttypes>
|
||||
#include "debug.h"
|
||||
|
||||
int sections_debug = DEBUG_NORMAL;
|
||||
@@ -34,7 +35,7 @@ void printdate_ms(FILE *f)
|
||||
gettimeofday(&now, NULL);
|
||||
struct tm *tm = localtime(&now.tv_sec);
|
||||
/* use strftime for that? */
|
||||
fprintf(f, "%04d-%02d-%02d %02d:%02d:%02d.%03ld ", tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, now.tv_usec / 1000);
|
||||
fprintf(f, "%04d-%02d-%02d %02d:%02d:%02d.%03" PRId64 " ", tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, (int64_t)(now.tv_usec / 1000));
|
||||
}
|
||||
|
||||
static int64_t last_profile_call;
|
||||
@@ -47,6 +48,6 @@ void showProfiling(std::string text)
|
||||
int64_t now = (int64_t) tv.tv_usec + (int64_t)((int64_t) tv.tv_sec * (int64_t) 1000000);
|
||||
|
||||
int64_t tmp = now - last_profile_call;
|
||||
printf("--> '%s' %lld.%03lld\n", text.c_str(), tmp / 1000LL, tmp % 1000LL);
|
||||
printf("--> '%s' %" PRId64 ".%03" PRId64 "\n", text.c_str(), tmp / 1000LL, tmp % 1000LL);
|
||||
last_profile_call = now;
|
||||
}
|
||||
|
Reference in New Issue
Block a user