[PATCH 1/2] include: Introduce wine_debugstr_reference_time to debug.h

Andrew Eikum aeikum at codeweavers.com
Mon Feb 7 08:49:41 CST 2022


Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
---
 dlls/evr/evr_private.h              | 21 ---------------------
 dlls/evr/presenter.c                | 10 +++++-----
 dlls/evr/sample.c                   | 27 +++------------------------
 dlls/mf/clock.c                     |  4 ++--
 dlls/mf/copier.c                    |  2 +-
 dlls/mf/evr.c                       | 12 ++++++------
 dlls/mf/mf_private.h                | 21 ---------------------
 dlls/mf/samplegrabber.c             | 10 +++++-----
 dlls/mf/sar.c                       | 12 ++++++------
 dlls/mfplat/buffer.c                |  2 +-
 dlls/mfplat/main.c                  | 10 +++++-----
 dlls/mfplat/mfplat_private.h        | 21 ---------------------
 dlls/mfplat/sample.c                |  4 ++--
 dlls/quartz/acmwrapper.c            |  6 +++---
 dlls/quartz/avidec.c                |  2 +-
 dlls/quartz/dsoundrender.c          | 10 +++++-----
 dlls/quartz/filtergraph.c           | 12 ++++++------
 dlls/quartz/memallocator.c          |  8 ++++----
 dlls/quartz/quartz_private.h        | 21 ---------------------
 dlls/quartz/systemclock.c           |  6 +++---
 dlls/winegstreamer/gst_private.h    | 21 ---------------------
 dlls/winegstreamer/quartz_parser.c  |  6 +++---
 dlls/winegstreamer/wm_asyncreader.c |  8 ++++----
 dlls/winegstreamer/wm_reader.c      |  8 ++++----
 include/wine/debug.h                | 21 +++++++++++++++++++++
 libs/strmbase/filter.c              |  2 +-
 libs/strmbase/mediatype.c           |  4 ++--
 libs/strmbase/pin.c                 |  4 ++--
 libs/strmbase/renderer.c            |  8 ++++----
 libs/strmbase/strmbase_private.h    | 21 ---------------------
 30 files changed, 99 insertions(+), 225 deletions(-)

diff --git a/dlls/evr/evr_private.h b/dlls/evr/evr_private.h
index ef38b0f70cf..dabaaf8ee1a 100644
--- a/dlls/evr/evr_private.h
+++ b/dlls/evr/evr_private.h
@@ -24,27 +24,6 @@
 #include "wine/strmbase.h"
 #include "wine/debug.h"
 
-static inline const char *debugstr_time(LONGLONG time)
-{
-    ULONGLONG abstime = time >= 0 ? time : -time;
-    unsigned int i = 0, j = 0;
-    char buffer[23], rev[23];
-
-    while (abstime || i <= 8)
-    {
-        buffer[i++] = '0' + (abstime % 10);
-        abstime /= 10;
-        if (i == 7) buffer[i++] = '.';
-    }
-    if (time < 0) buffer[i++] = '-';
-
-    while (i--) rev[j++] = buffer[i];
-    while (rev[j-1] == '0' && rev[j-2] != '.') --j;
-    rev[j] = 0;
-
-    return wine_dbg_sprintf("%s", rev);
-}
-
 static inline const char *debugstr_normalized_rect(const MFVideoNormalizedRect *rect)
 {
     if (!rect) return "(null)";
diff --git a/dlls/evr/presenter.c b/dlls/evr/presenter.c
index 7e14cb2f720..864891eec6d 100644
--- a/dlls/evr/presenter.c
+++ b/dlls/evr/presenter.c
@@ -902,7 +902,7 @@ static HRESULT WINAPI video_presenter_OnClockStart(IMFVideoPresenter *iface, MFT
 {
     struct video_presenter *presenter = impl_from_IMFVideoPresenter(iface);
 
-    TRACE("%p, %s, %s.\n", iface, debugstr_time(systime), wine_dbgstr_longlong(offset));
+    TRACE("%p, %s, %s.\n", iface, wine_dbgstr_reference_time(systime), wine_dbgstr_longlong(offset));
 
     EnterCriticalSection(&presenter->cs);
     presenter->state = PRESENTER_STATE_STARTED;
@@ -915,7 +915,7 @@ static HRESULT WINAPI video_presenter_OnClockStop(IMFVideoPresenter *iface, MFTI
 {
     struct video_presenter *presenter = impl_from_IMFVideoPresenter(iface);
 
-    TRACE("%p, %s.\n", iface, debugstr_time(systime));
+    TRACE("%p, %s.\n", iface, wine_dbgstr_reference_time(systime));
 
     EnterCriticalSection(&presenter->cs);
     presenter->state = PRESENTER_STATE_STOPPED;
@@ -929,7 +929,7 @@ static HRESULT WINAPI video_presenter_OnClockPause(IMFVideoPresenter *iface, MFT
 {
     struct video_presenter *presenter = impl_from_IMFVideoPresenter(iface);
 
-    TRACE("%p, %s.\n", iface, debugstr_time(systime));
+    TRACE("%p, %s.\n", iface, wine_dbgstr_reference_time(systime));
 
     EnterCriticalSection(&presenter->cs);
     presenter->state = PRESENTER_STATE_PAUSED;
@@ -942,7 +942,7 @@ static HRESULT WINAPI video_presenter_OnClockRestart(IMFVideoPresenter *iface, M
 {
     struct video_presenter *presenter = impl_from_IMFVideoPresenter(iface);
 
-    TRACE("%p, %s.\n", iface, debugstr_time(systime));
+    TRACE("%p, %s.\n", iface, wine_dbgstr_reference_time(systime));
 
     EnterCriticalSection(&presenter->cs);
     presenter->state = PRESENTER_STATE_STARTED;
@@ -953,7 +953,7 @@ static HRESULT WINAPI video_presenter_OnClockRestart(IMFVideoPresenter *iface, M
 
 static HRESULT WINAPI video_presenter_OnClockSetRate(IMFVideoPresenter *iface, MFTIME systime, float rate)
 {
-    FIXME("%p, %s, %f.\n", iface, debugstr_time(systime), rate);
+    FIXME("%p, %s, %f.\n", iface, wine_dbgstr_reference_time(systime), rate);
 
     return E_NOTIMPL;
 }
diff --git a/dlls/evr/sample.c b/dlls/evr/sample.c
index 1d29b6cdc2c..b8ac408e4ff 100644
--- a/dlls/evr/sample.c
+++ b/dlls/evr/sample.c
@@ -29,27 +29,6 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(evr);
 
-static const char *debugstr_time(LONGLONG time)
-{
-    ULONGLONG abstime = time >= 0 ? time : -time;
-    unsigned int i = 0, j = 0;
-    char buffer[23], rev[23];
-
-    while (abstime || i <= 8)
-    {
-        buffer[i++] = '0' + (abstime % 10);
-        abstime /= 10;
-        if (i == 7) buffer[i++] = '.';
-    }
-    if (time < 0) buffer[i++] = '-';
-
-    while (i--) rev[j++] = buffer[i];
-    while (rev[j-1] == '0' && rev[j-2] != '.') --j;
-    rev[j] = 0;
-
-    return wine_dbg_sprintf("%s", rev);
-}
-
 struct surface_buffer
 {
     IMFMediaBuffer IMFMediaBuffer_iface;
@@ -1258,7 +1237,7 @@ static HRESULT WINAPI video_sample_SetSampleTime(IMFSample *iface, LONGLONG time
 {
     struct video_sample *sample = impl_from_IMFSample(iface);
 
-    TRACE("%p, %s.\n", iface, debugstr_time(timestamp));
+    TRACE("%p, %s.\n", iface, wine_dbgstr_reference_time(timestamp));
 
     EnterCriticalSection(&sample->cs);
     sample->timestamp = timestamp;
@@ -1289,7 +1268,7 @@ static HRESULT WINAPI video_sample_SetSampleDuration(IMFSample *iface, LONGLONG
 {
     struct video_sample *sample = impl_from_IMFSample(iface);
 
-    TRACE("%p, %s.\n", iface, debugstr_time(duration));
+    TRACE("%p, %s.\n", iface, wine_dbgstr_reference_time(duration));
 
     EnterCriticalSection(&sample->cs);
     sample->duration = duration;
@@ -1523,7 +1502,7 @@ static void WINAPI desired_video_sample_SetDesiredSampleTimeAndDuration(IMFDesir
 {
     struct video_sample *sample = impl_from_IMFDesiredSample(iface);
 
-    TRACE("%p, %s, %s.\n", iface, debugstr_time(sample_time), debugstr_time(sample_duration));
+    TRACE("%p, %s, %s.\n", iface, wine_dbgstr_reference_time(sample_time), wine_dbgstr_reference_time(sample_duration));
 
     EnterCriticalSection(&sample->cs);
     sample->flags |= SAMPLE_PROP_HAS_DESIRED_PROPS;
diff --git a/dlls/mf/clock.c b/dlls/mf/clock.c
index 4a3ad7ec7c1..a4212ee0402 100644
--- a/dlls/mf/clock.c
+++ b/dlls/mf/clock.c
@@ -660,7 +660,7 @@ static HRESULT WINAPI present_clock_Start(IMFPresentationClock *iface, LONGLONG
     struct clock_state_change_param param = {{0}};
     HRESULT hr;
 
-    TRACE("%p, %s.\n", iface, debugstr_time(start_offset));
+    TRACE("%p, %s.\n", iface, wine_dbgstr_reference_time(start_offset));
 
     EnterCriticalSection(&clock->cs);
     clock->start_offset = param.u.offset = start_offset;
@@ -885,7 +885,7 @@ static HRESULT WINAPI present_clock_timer_SetTimer(IMFTimer *iface, DWORD flags,
     struct clock_timer *clock_timer;
     HRESULT hr;
 
-    TRACE("%p, %#x, %s, %p, %p, %p.\n", iface, flags, debugstr_time(time), callback, state, cancel_key);
+    TRACE("%p, %#x, %s, %p, %p, %p.\n", iface, flags, wine_dbgstr_reference_time(time), callback, state, cancel_key);
 
     if (!(clock_timer = calloc(1, sizeof(*clock_timer))))
         return E_OUTOFMEMORY;
diff --git a/dlls/mf/copier.c b/dlls/mf/copier.c
index fe5664ee4c7..4972c9f9c44 100644
--- a/dlls/mf/copier.c
+++ b/dlls/mf/copier.c
@@ -424,7 +424,7 @@ static HRESULT WINAPI sample_copier_transform_GetOutputStatus(IMFTransform *ifac
 
 static HRESULT WINAPI sample_copier_transform_SetOutputBounds(IMFTransform *iface, LONGLONG lower, LONGLONG upper)
 {
-    TRACE("%p, %s, %s.\n", iface, debugstr_time(lower), debugstr_time(upper));
+    TRACE("%p, %s, %s.\n", iface, wine_dbgstr_reference_time(lower), wine_dbgstr_reference_time(upper));
 
     return E_NOTIMPL;
 }
diff --git a/dlls/mf/evr.c b/dlls/mf/evr.c
index 5e8b559af04..173e712ab84 100644
--- a/dlls/mf/evr.c
+++ b/dlls/mf/evr.c
@@ -1504,7 +1504,7 @@ static HRESULT WINAPI video_renderer_preroll_NotifyPreroll(IMFMediaSinkPreroll *
     HRESULT hr = S_OK;
     size_t i;
 
-    TRACE("%p, %s.\n", iface, debugstr_time(start_time));
+    TRACE("%p, %s.\n", iface, wine_dbgstr_reference_time(start_time));
 
     EnterCriticalSection(&renderer->cs);
     if (renderer->flags & EVR_SHUT_DOWN)
@@ -1880,7 +1880,7 @@ static HRESULT WINAPI video_renderer_clock_sink_OnClockStart(IMFClockStateSink *
     unsigned int state, request_sample;
     size_t i;
 
-    TRACE("%p, %s, %s.\n", iface, debugstr_time(systime), debugstr_time(offset));
+    TRACE("%p, %s, %s.\n", iface, wine_dbgstr_reference_time(systime), wine_dbgstr_reference_time(offset));
 
     EnterCriticalSection(&renderer->cs);
 
@@ -1923,7 +1923,7 @@ static HRESULT WINAPI video_renderer_clock_sink_OnClockStop(IMFClockStateSink *i
     struct video_renderer *renderer = impl_from_IMFClockStateSink(iface);
     size_t i;
 
-    TRACE("%p, %s.\n", iface, debugstr_time(systime));
+    TRACE("%p, %s.\n", iface, wine_dbgstr_reference_time(systime));
 
     EnterCriticalSection(&renderer->cs);
 
@@ -1960,7 +1960,7 @@ static HRESULT WINAPI video_renderer_clock_sink_OnClockPause(IMFClockStateSink *
     struct video_renderer *renderer = impl_from_IMFClockStateSink(iface);
     size_t i;
 
-    TRACE("%p, %s.\n", iface, debugstr_time(systime));
+    TRACE("%p, %s.\n", iface, wine_dbgstr_reference_time(systime));
 
     EnterCriticalSection(&renderer->cs);
 
@@ -1987,7 +1987,7 @@ static HRESULT WINAPI video_renderer_clock_sink_OnClockRestart(IMFClockStateSink
     struct video_renderer *renderer = impl_from_IMFClockStateSink(iface);
     size_t i;
 
-    TRACE("%p, %s.\n", iface, debugstr_time(systime));
+    TRACE("%p, %s.\n", iface, wine_dbgstr_reference_time(systime));
 
     EnterCriticalSection(&renderer->cs);
 
@@ -2010,7 +2010,7 @@ static HRESULT WINAPI video_renderer_clock_sink_OnClockSetRate(IMFClockStateSink
     struct video_renderer *renderer = impl_from_IMFClockStateSink(iface);
     IMFClockStateSink *sink;
 
-    TRACE("%p, %s, %f.\n", iface, debugstr_time(systime), rate);
+    TRACE("%p, %s, %f.\n", iface, wine_dbgstr_reference_time(systime), rate);
 
     EnterCriticalSection(&renderer->cs);
 
diff --git a/dlls/mf/mf_private.h b/dlls/mf/mf_private.h
index db6f101cd6d..c6f853e4950 100644
--- a/dlls/mf/mf_private.h
+++ b/dlls/mf/mf_private.h
@@ -58,27 +58,6 @@ struct activate_funcs
 
 HRESULT create_activation_object(void *context, const struct activate_funcs *funcs, IMFActivate **ret) DECLSPEC_HIDDEN;
 
-static inline const char *debugstr_time(LONGLONG time)
-{
-    ULONGLONG abstime = time >= 0 ? time : -time;
-    unsigned int i = 0, j = 0;
-    char buffer[23], rev[23];
-
-    while (abstime || i <= 8)
-    {
-        buffer[i++] = '0' + (abstime % 10);
-        abstime /= 10;
-        if (i == 7) buffer[i++] = '.';
-    }
-    if (time < 0) buffer[i++] = '-';
-
-    while (i--) rev[j++] = buffer[i];
-    while (rev[j-1] == '0' && rev[j-2] != '.') --j;
-    rev[j] = 0;
-
-    return wine_dbg_sprintf("%s", rev);
-}
-
 extern BOOL mf_is_sample_copier_transform(IMFTransform *transform) DECLSPEC_HIDDEN;
 extern BOOL mf_is_sar_sink(IMFMediaSink *sink) DECLSPEC_HIDDEN;
 extern HRESULT topology_node_get_object(IMFTopologyNode *node, REFIID riid, void **obj) DECLSPEC_HIDDEN;
diff --git a/dlls/mf/samplegrabber.c b/dlls/mf/samplegrabber.c
index e7d3be68df3..53c7e381d6a 100644
--- a/dlls/mf/samplegrabber.c
+++ b/dlls/mf/samplegrabber.c
@@ -1170,7 +1170,7 @@ static HRESULT WINAPI sample_grabber_clock_sink_OnClockStart(IMFClockStateSink *
 {
     struct sample_grabber *grabber = impl_from_IMFClockStateSink(iface);
 
-    TRACE("%p, %s, %s.\n", iface, debugstr_time(systime), debugstr_time(offset));
+    TRACE("%p, %s, %s.\n", iface, wine_dbgstr_reference_time(systime), wine_dbgstr_reference_time(offset));
 
     return sample_grabber_set_state(grabber, SINK_STATE_RUNNING, systime, offset);
 }
@@ -1179,7 +1179,7 @@ static HRESULT WINAPI sample_grabber_clock_sink_OnClockStop(IMFClockStateSink *i
 {
     struct sample_grabber *grabber = impl_from_IMFClockStateSink(iface);
 
-    TRACE("%p, %s.\n", iface, debugstr_time(systime));
+    TRACE("%p, %s.\n", iface, wine_dbgstr_reference_time(systime));
 
     return sample_grabber_set_state(grabber, SINK_STATE_STOPPED, systime, 0);
 }
@@ -1188,7 +1188,7 @@ static HRESULT WINAPI sample_grabber_clock_sink_OnClockPause(IMFClockStateSink *
 {
     struct sample_grabber *grabber = impl_from_IMFClockStateSink(iface);
 
-    TRACE("%p, %s.\n", iface, debugstr_time(systime));
+    TRACE("%p, %s.\n", iface, wine_dbgstr_reference_time(systime));
 
     return sample_grabber_set_state(grabber, SINK_STATE_PAUSED, systime, 0);
 }
@@ -1197,7 +1197,7 @@ static HRESULT WINAPI sample_grabber_clock_sink_OnClockRestart(IMFClockStateSink
 {
     struct sample_grabber *grabber = impl_from_IMFClockStateSink(iface);
 
-    TRACE("%p, %s.\n", iface, debugstr_time(systime));
+    TRACE("%p, %s.\n", iface, wine_dbgstr_reference_time(systime));
 
     return sample_grabber_set_state(grabber, SINK_STATE_RUNNING, systime, PRESENTATION_CURRENT_POSITION);
 }
@@ -1206,7 +1206,7 @@ static HRESULT WINAPI sample_grabber_clock_sink_OnClockSetRate(IMFClockStateSink
 {
     struct sample_grabber *grabber = impl_from_IMFClockStateSink(iface);
 
-    TRACE("%p, %s, %f.\n", iface, debugstr_time(systime), rate);
+    TRACE("%p, %s, %f.\n", iface, wine_dbgstr_reference_time(systime), rate);
 
     return IMFSampleGrabberSinkCallback_OnClockSetRate(sample_grabber_get_callback(grabber), systime, rate);
 }
diff --git a/dlls/mf/sar.c b/dlls/mf/sar.c
index 3c9bac90c9f..a6513fc167f 100644
--- a/dlls/mf/sar.c
+++ b/dlls/mf/sar.c
@@ -518,7 +518,7 @@ static HRESULT WINAPI audio_renderer_preroll_NotifyPreroll(IMFMediaSinkPreroll *
 {
     struct audio_renderer *renderer = impl_from_IMFMediaSinkPreroll(iface);
 
-    TRACE("%p, %s.\n", iface, debugstr_time(start_time));
+    TRACE("%p, %s.\n", iface, wine_dbgstr_reference_time(start_time));
 
     if (renderer->flags & SAR_SHUT_DOWN)
         return MF_E_SHUTDOWN;
@@ -626,7 +626,7 @@ static HRESULT WINAPI audio_renderer_clock_sink_OnClockStart(IMFClockStateSink *
     struct audio_renderer *renderer = impl_from_IMFClockStateSink(iface);
     HRESULT hr = S_OK;
 
-    TRACE("%p, %s, %s.\n", iface, debugstr_time(systime), debugstr_time(offset));
+    TRACE("%p, %s, %s.\n", iface, wine_dbgstr_reference_time(systime), wine_dbgstr_reference_time(offset));
 
     EnterCriticalSection(&renderer->cs);
     if (renderer->audio_client)
@@ -654,7 +654,7 @@ static HRESULT WINAPI audio_renderer_clock_sink_OnClockStop(IMFClockStateSink *i
     struct audio_renderer *renderer = impl_from_IMFClockStateSink(iface);
     HRESULT hr = S_OK;
 
-    TRACE("%p, %s.\n", iface, debugstr_time(systime));
+    TRACE("%p, %s.\n", iface, wine_dbgstr_reference_time(systime));
 
     EnterCriticalSection(&renderer->cs);
     if (renderer->audio_client)
@@ -686,7 +686,7 @@ static HRESULT WINAPI audio_renderer_clock_sink_OnClockPause(IMFClockStateSink *
     struct audio_renderer *renderer = impl_from_IMFClockStateSink(iface);
     HRESULT hr;
 
-    TRACE("%p, %s.\n", iface, debugstr_time(systime));
+    TRACE("%p, %s.\n", iface, wine_dbgstr_reference_time(systime));
 
     EnterCriticalSection(&renderer->cs);
     if (renderer->state == STREAM_STATE_RUNNING)
@@ -715,7 +715,7 @@ static HRESULT WINAPI audio_renderer_clock_sink_OnClockRestart(IMFClockStateSink
     BOOL preroll = FALSE;
     HRESULT hr = S_OK;
 
-    TRACE("%p, %s.\n", iface, debugstr_time(systime));
+    TRACE("%p, %s.\n", iface, wine_dbgstr_reference_time(systime));
 
     EnterCriticalSection(&renderer->cs);
     if (renderer->audio_client)
@@ -741,7 +741,7 @@ static HRESULT WINAPI audio_renderer_clock_sink_OnClockRestart(IMFClockStateSink
 
 static HRESULT WINAPI audio_renderer_clock_sink_OnClockSetRate(IMFClockStateSink *iface, MFTIME systime, float rate)
 {
-    FIXME("%p, %s, %f.\n", iface, debugstr_time(systime), rate);
+    FIXME("%p, %s, %f.\n", iface, wine_dbgstr_reference_time(systime), rate);
 
     return E_NOTIMPL;
 }
diff --git a/dlls/mfplat/buffer.c b/dlls/mfplat/buffer.c
index f161bb29d80..525c902d192 100644
--- a/dlls/mfplat/buffer.c
+++ b/dlls/mfplat/buffer.c
@@ -1560,7 +1560,7 @@ HRESULT WINAPI MFCreateMediaBufferFromMediaType(IMFMediaType *media_type, LONGLO
     HRESULT hr;
     GUID major;
 
-    TRACE("%p, %s, %u, %u, %p.\n", media_type, debugstr_time(duration), min_length, alignment, buffer);
+    TRACE("%p, %s, %u, %u, %p.\n", media_type, wine_dbgstr_reference_time(duration), min_length, alignment, buffer);
 
     if (!media_type)
         return E_INVALIDARG;
diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c
index e79f59d41dd..ec24b32318b 100644
--- a/dlls/mfplat/main.c
+++ b/dlls/mfplat/main.c
@@ -8057,7 +8057,7 @@ static HRESULT WINAPI system_time_source_sink_OnClockStart(IMFClockStateSink *if
     MFCLOCK_STATE state;
     HRESULT hr;
 
-    TRACE("%p, %s, %s.\n", iface, debugstr_time(system_time), debugstr_time(start_offset));
+    TRACE("%p, %s, %s.\n", iface, wine_dbgstr_reference_time(system_time), wine_dbgstr_reference_time(start_offset));
 
     EnterCriticalSection(&source->cs);
     state = source->state;
@@ -8094,7 +8094,7 @@ static HRESULT WINAPI system_time_source_sink_OnClockStop(IMFClockStateSink *ifa
     struct system_time_source *source = impl_from_IMFClockStateSink(iface);
     HRESULT hr;
 
-    TRACE("%p, %s.\n", iface, debugstr_time(system_time));
+    TRACE("%p, %s.\n", iface, wine_dbgstr_reference_time(system_time));
 
     EnterCriticalSection(&source->cs);
     if (SUCCEEDED(hr = system_time_source_change_state(source, CLOCK_CMD_STOP)))
@@ -8109,7 +8109,7 @@ static HRESULT WINAPI system_time_source_sink_OnClockPause(IMFClockStateSink *if
     struct system_time_source *source = impl_from_IMFClockStateSink(iface);
     HRESULT hr;
 
-    TRACE("%p, %s.\n", iface, debugstr_time(system_time));
+    TRACE("%p, %s.\n", iface, wine_dbgstr_reference_time(system_time));
 
     EnterCriticalSection(&source->cs);
     if (SUCCEEDED(hr = system_time_source_change_state(source, CLOCK_CMD_PAUSE)))
@@ -8127,7 +8127,7 @@ static HRESULT WINAPI system_time_source_sink_OnClockRestart(IMFClockStateSink *
     struct system_time_source *source = impl_from_IMFClockStateSink(iface);
     HRESULT hr;
 
-    TRACE("%p, %s.\n", iface, debugstr_time(system_time));
+    TRACE("%p, %s.\n", iface, wine_dbgstr_reference_time(system_time));
 
     EnterCriticalSection(&source->cs);
     if (SUCCEEDED(hr = system_time_source_change_state(source, CLOCK_CMD_RESTART)))
@@ -8145,7 +8145,7 @@ static HRESULT WINAPI system_time_source_sink_OnClockSetRate(IMFClockStateSink *
     struct system_time_source *source = impl_from_IMFClockStateSink(iface);
     double intpart;
 
-    TRACE("%p, %s, %f.\n", iface, debugstr_time(system_time), rate);
+    TRACE("%p, %s, %f.\n", iface, wine_dbgstr_reference_time(system_time), rate);
 
     if (rate == 0.0f)
         return MF_E_UNSUPPORTED_RATE;
diff --git a/dlls/mfplat/mfplat_private.h b/dlls/mfplat/mfplat_private.h
index b646d9e7cbb..bc673987650 100644
--- a/dlls/mfplat/mfplat_private.h
+++ b/dlls/mfplat/mfplat_private.h
@@ -183,24 +183,3 @@ static inline const char *debugstr_fourcc(DWORD format)
 
     return wine_dbgstr_an((char *)&format, 4);
 }
-
-static inline const char *debugstr_time(LONGLONG time)
-{
-    ULONGLONG abstime = time >= 0 ? time : -time;
-    unsigned int i = 0, j = 0;
-    char buffer[23], rev[23];
-
-    while (abstime || i <= 8)
-    {
-        buffer[i++] = '0' + (abstime % 10);
-        abstime /= 10;
-        if (i == 7) buffer[i++] = '.';
-    }
-    if (time < 0) buffer[i++] = '-';
-
-    while (i--) rev[j++] = buffer[i];
-    while (rev[j-1] == '0' && rev[j-2] != '.') --j;
-    rev[j] = 0;
-
-    return wine_dbg_sprintf("%s", rev);
-}
diff --git a/dlls/mfplat/sample.c b/dlls/mfplat/sample.c
index 04c68c87199..72eca896dae 100644
--- a/dlls/mfplat/sample.c
+++ b/dlls/mfplat/sample.c
@@ -528,7 +528,7 @@ static HRESULT WINAPI sample_SetSampleTime(IMFSample *iface, LONGLONG timestamp)
 {
     struct sample *sample = impl_from_IMFSample(iface);
 
-    TRACE("%p, %s.\n", iface, debugstr_time(timestamp));
+    TRACE("%p, %s.\n", iface, wine_dbgstr_reference_time(timestamp));
 
     EnterCriticalSection(&sample->attributes.cs);
     sample->timestamp = timestamp;
@@ -559,7 +559,7 @@ static HRESULT WINAPI sample_SetSampleDuration(IMFSample *iface, LONGLONG durati
 {
     struct sample *sample = impl_from_IMFSample(iface);
 
-    TRACE("%p, %s.\n", iface, debugstr_time(duration));
+    TRACE("%p, %s.\n", iface, wine_dbgstr_reference_time(duration));
 
     EnterCriticalSection(&sample->attributes.cs);
     sample->duration = duration;
diff --git a/dlls/quartz/acmwrapper.c b/dlls/quartz/acmwrapper.c
index 12d96f69376..04f942b7d9d 100644
--- a/dlls/quartz/acmwrapper.c
+++ b/dlls/quartz/acmwrapper.c
@@ -203,7 +203,7 @@ static HRESULT WINAPI acm_wrapper_sink_Receive(struct strmbase_sink *iface, IMed
             goto error;
         }
 
-        TRACE("Sample start time: %s.\n", debugstr_time(tStart));
+        TRACE("Sample start time: %s.\n", wine_dbgstr_reference_time(tStart));
         if (ash.cbSrcLengthUsed == cbSrcStream)
         {
             IMediaSample_SetTime(pOutSample, &tStart, &tStop);
@@ -236,7 +236,7 @@ static HRESULT WINAPI acm_wrapper_sink_Receive(struct strmbase_sink *iface, IMed
             IMediaSample_SetMediaTime(pOutSample, NULL, NULL);
         }
 
-        TRACE("Sample stop time: %s\n", debugstr_time(tStart));
+        TRACE("Sample stop time: %s\n", wine_dbgstr_reference_time(tStart));
 
         hr = IMemInputPin_Receive(This->source.pMemInputPin, pOutSample);
         if (hr != S_OK && hr != VFW_E_NOT_CONNECTED) {
@@ -418,7 +418,7 @@ static HRESULT WINAPI acm_wrapper_source_qc_Notify(IQualityControl *iface,
     HRESULT hr = S_OK;
 
     TRACE("filter %p, sender %p, type %#x, proportion %ld, late %s, timestamp %s.\n",
-            filter, sender, q.Type, q.Proportion, debugstr_time(q.Late), debugstr_time(q.TimeStamp));
+            filter, sender, q.Type, q.Proportion, wine_dbgstr_reference_time(q.Late), wine_dbgstr_reference_time(q.TimeStamp));
 
     if (filter->source_qc_sink)
         return IQualityControl_Notify(filter->source_qc_sink, &filter->filter.IBaseFilter_iface, q);
diff --git a/dlls/quartz/avidec.c b/dlls/quartz/avidec.c
index 30b6c741eed..ebd59beaf70 100644
--- a/dlls/quartz/avidec.c
+++ b/dlls/quartz/avidec.c
@@ -477,7 +477,7 @@ static HRESULT WINAPI avi_decompressor_source_qc_Notify(IQualityControl *iface,
     struct avi_decompressor *filter = impl_from_source_IQualityControl(iface);
 
     TRACE("filter %p, sender %p, type %#x, proportion %ld, late %s, timestamp %s.\n",
-            filter, sender, q.Type, q.Proportion, debugstr_time(q.Late), debugstr_time(q.TimeStamp));
+            filter, sender, q.Type, q.Proportion, wine_dbgstr_reference_time(q.Late), wine_dbgstr_reference_time(q.TimeStamp));
 
     EnterCriticalSection(&filter->filter.stream_cs);
     if (q.Late > 0)
diff --git a/dlls/quartz/dsoundrender.c b/dlls/quartz/dsoundrender.c
index 1abd4bdbcec..4f6ebb620e5 100644
--- a/dlls/quartz/dsoundrender.c
+++ b/dlls/quartz/dsoundrender.c
@@ -182,7 +182,7 @@ static HRESULT DSoundRender_GetWritePos(struct dsound_render *This,
         *ret_writepos = writepos;
     } else if (delta_t < 0) {
         REFERENCE_TIME past, min_writepos_t;
-        WARN("Delta too big %s/%s, overwriting old data or even skipping\n", debugstr_time(delta_t), debugstr_time(max_lag));
+        WARN("Delta too big %s/%s, overwriting old data or even skipping\n", wine_dbgstr_reference_time(delta_t), wine_dbgstr_reference_time(max_lag));
         if (min_writepos >= playpos)
             min_writepos_t = cur + time_from_pos(This, min_writepos - playpos);
         else
@@ -200,7 +200,7 @@ static HRESULT DSoundRender_GetWritePos(struct dsound_render *This,
         }
     } else /* delta_t > 0 */ {
         DWORD aheadbytes;
-        WARN("Delta too big %s/%s, too far ahead\n", debugstr_time(delta_t), debugstr_time(max_lag));
+        WARN("Delta too big %s/%s, too far ahead\n", wine_dbgstr_reference_time(delta_t), wine_dbgstr_reference_time(max_lag));
         aheadbytes = pos_from_time(This, delta_t);
         WARN("Advancing %lu bytes.\n", aheadbytes);
         if (delta_t >= DSoundRenderer_Max_Fill)
@@ -213,8 +213,8 @@ end:
     else
         *pfree = This->buf_size + playpos - *ret_writepos;
     if (time_from_pos(This, This->buf_size - *pfree) >= DSoundRenderer_Max_Fill) {
-        TRACE("Blocked: too full %s / %s\n", debugstr_time(time_from_pos(This, This->buf_size - *pfree)),
-                debugstr_time(DSoundRenderer_Max_Fill));
+        TRACE("Blocked: too full %s / %s\n", wine_dbgstr_reference_time(time_from_pos(This, This->buf_size - *pfree)),
+                wine_dbgstr_reference_time(DSoundRenderer_Max_Fill));
         return S_FALSE;
     }
     return S_OK;
@@ -962,7 +962,7 @@ static HRESULT WINAPI dsound_render_qc_Notify(IQualityControl *iface,
     struct dsound_render *filter = impl_from_IQualityControl(iface);
 
     FIXME("filter %p, sender %p, type %#x, proportion %ld, late %s, timestamp %s, stub!\n",
-            filter, sender, q.Type, q.Proportion, debugstr_time(q.Late), debugstr_time(q.TimeStamp));
+            filter, sender, q.Type, q.Proportion, wine_dbgstr_reference_time(q.Late), wine_dbgstr_reference_time(q.TimeStamp));
 
     return E_NOTIMPL;
 }
diff --git a/dlls/quartz/filtergraph.c b/dlls/quartz/filtergraph.c
index 1849174cf97..867eab011d5 100644
--- a/dlls/quartz/filtergraph.c
+++ b/dlls/quartz/filtergraph.c
@@ -2249,7 +2249,7 @@ static HRESULT WINAPI MediaSeeking_GetDuration(IMediaSeeking *iface, LONGLONG *d
     LeaveCriticalSection(&graph->cs);
 
     TRACE("Returning hr %#lx, duration %s (%s seconds).\n", hr,
-            wine_dbgstr_longlong(*duration), debugstr_time(*duration));
+            wine_dbgstr_longlong(*duration), wine_dbgstr_reference_time(*duration));
     return hr;
 }
 
@@ -2290,7 +2290,7 @@ static HRESULT WINAPI MediaSeeking_GetStopPosition(IMediaSeeking *iface, LONGLON
 
     LeaveCriticalSection(&graph->cs);
 
-    TRACE("Returning %s (%s seconds).\n", wine_dbgstr_longlong(*stop), debugstr_time(*stop));
+    TRACE("Returning %s (%s seconds).\n", wine_dbgstr_longlong(*stop), wine_dbgstr_reference_time(*stop));
     return hr;
 }
 
@@ -2320,7 +2320,7 @@ static HRESULT WINAPI MediaSeeking_GetCurrentPosition(IMediaSeeking *iface, LONG
 
     LeaveCriticalSection(&graph->cs);
 
-    TRACE("Returning %s (%s seconds).\n", wine_dbgstr_longlong(ret), debugstr_time(ret));
+    TRACE("Returning %s (%s seconds).\n", wine_dbgstr_longlong(ret), wine_dbgstr_reference_time(ret));
     *current = ret;
 
     return S_OK;
@@ -2361,10 +2361,10 @@ static HRESULT WINAPI MediaSeeking_SetPositions(IMediaSeeking *iface, LONGLONG *
             stop_ptr ? wine_dbgstr_longlong(*stop_ptr): "<null>", stop_flags);
     if (current_ptr)
         TRACE("Setting current position to %s (%s seconds).\n",
-                wine_dbgstr_longlong(*current_ptr), debugstr_time(*current_ptr));
+                wine_dbgstr_longlong(*current_ptr), wine_dbgstr_reference_time(*current_ptr));
     if (stop_ptr)
         TRACE("Setting stop position to %s (%s seconds).\n",
-                wine_dbgstr_longlong(*stop_ptr), debugstr_time(*stop_ptr));
+                wine_dbgstr_longlong(*stop_ptr), wine_dbgstr_reference_time(*stop_ptr));
 
     if ((current_flags & 0x7) != AM_SEEKING_AbsolutePositioning
             && (current_flags & 0x7) != AM_SEEKING_NoPositioning)
@@ -5093,7 +5093,7 @@ static HRESULT WINAPI MediaFilter_Run(IMediaFilter *iface, REFERENCE_TIME start)
     struct filter_graph *graph = impl_from_IMediaFilter(iface);
     HRESULT hr;
 
-    TRACE("graph %p, start %s.\n", graph, debugstr_time(start));
+    TRACE("graph %p, start %s.\n", graph, wine_dbgstr_reference_time(start));
 
     EnterCriticalSection(&graph->cs);
 
diff --git a/dlls/quartz/memallocator.c b/dlls/quartz/memallocator.c
index 87869b4d6b2..715f4b704e0 100644
--- a/dlls/quartz/memallocator.c
+++ b/dlls/quartz/memallocator.c
@@ -560,8 +560,8 @@ static HRESULT WINAPI StdMediaSample2_SetTime(IMediaSample2 *iface, REFERENCE_TI
 {
     StdMediaSample2 *sample = impl_from_IMediaSample2(iface);
 
-    TRACE("sample %p, start %s, end %s.\n", sample, start ? debugstr_time(*start) : "(null)",
-            end ? debugstr_time(*end) : "(null)");
+    TRACE("sample %p, start %s, end %s.\n", sample, start ? wine_dbgstr_reference_time(*start) : "(null)",
+            end ? wine_dbgstr_reference_time(*end) : "(null)");
 
     if (start)
     {
@@ -742,8 +742,8 @@ static HRESULT WINAPI StdMediaSample2_SetMediaTime(IMediaSample2 *iface, LONGLON
 {
     StdMediaSample2 *sample = impl_from_IMediaSample2(iface);
 
-    TRACE("sample %p, start %s, end %s.\n", sample, start ? debugstr_time(*start) : "(null)",
-            end ? debugstr_time(*end) : "(null)");
+    TRACE("sample %p, start %s, end %s.\n", sample, start ? wine_dbgstr_reference_time(*start) : "(null)",
+            end ? wine_dbgstr_reference_time(*end) : "(null)");
 
     if (start)
     {
diff --git a/dlls/quartz/quartz_private.h b/dlls/quartz/quartz_private.h
index c706d906a26..c68a65244a3 100644
--- a/dlls/quartz/quartz_private.h
+++ b/dlls/quartz/quartz_private.h
@@ -37,27 +37,6 @@
 #include "wine/strmbase.h"
 #include "wine/list.h"
 
-static inline const char *debugstr_time(REFERENCE_TIME time)
-{
-    ULONGLONG abstime = time >= 0 ? time : -time;
-    unsigned int i = 0, j = 0;
-    char buffer[23], rev[23];
-
-    while (abstime || i <= 8)
-    {
-        buffer[i++] = '0' + (abstime % 10);
-        abstime /= 10;
-        if (i == 7) buffer[i++] = '.';
-    }
-    if (time < 0) buffer[i++] = '-';
-
-    while (i--) rev[j++] = buffer[i];
-    while (rev[j-1] == '0' && rev[j-2] != '.') --j;
-    rev[j] = 0;
-
-    return wine_dbg_sprintf("%s", rev);
-}
-
 /* see IAsyncReader::Request on MSDN for the explanation of this */
 #define MEDIATIME_FROM_BYTES(x) ((LONGLONG)(x) * 10000000)
 #define BYTES_FROM_MEDIATIME(time) ((time) / 10000000)
diff --git a/dlls/quartz/systemclock.c b/dlls/quartz/systemclock.c
index 729122fec46..9bdbd3e62eb 100644
--- a/dlls/quartz/systemclock.c
+++ b/dlls/quartz/systemclock.c
@@ -259,7 +259,7 @@ static HRESULT WINAPI SystemClockImpl_GetTime(IReferenceClock *iface, REFERENCE_
 
     LeaveCriticalSection(&clock->cs);
 
-    TRACE("clock %p, time %p, returning %s.\n", clock, time, debugstr_time(ret));
+    TRACE("clock %p, time %p, returning %s.\n", clock, time, wine_dbgstr_reference_time(ret));
     return hr;
 }
 
@@ -269,7 +269,7 @@ static HRESULT WINAPI SystemClockImpl_AdviseTime(IReferenceClock *iface,
     struct system_clock *clock = impl_from_IReferenceClock(iface);
 
     TRACE("clock %p, base %s, offset %s, event %#Ix, cookie %p.\n",
-            clock, debugstr_time(base), debugstr_time(offset), event, cookie);
+            clock, wine_dbgstr_reference_time(base), wine_dbgstr_reference_time(offset), event, cookie);
 
     if (base + offset <= 0)
         return E_INVALIDARG;
@@ -283,7 +283,7 @@ static HRESULT WINAPI SystemClockImpl_AdvisePeriodic(IReferenceClock* iface,
     struct system_clock *clock = impl_from_IReferenceClock(iface);
 
     TRACE("clock %p, start %s, period %s, semaphore %#Ix, cookie %p.\n",
-            clock, debugstr_time(start), debugstr_time(period), semaphore, cookie);
+            clock, wine_dbgstr_reference_time(start), wine_dbgstr_reference_time(period), semaphore, cookie);
 
     if (start <= 0 || period <= 0)
         return E_INVALIDARG;
diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h
index 222bce3b2c7..7286688666d 100644
--- a/dlls/winegstreamer/gst_private.h
+++ b/dlls/winegstreamer/gst_private.h
@@ -41,27 +41,6 @@
 
 bool array_reserve(void **elements, size_t *capacity, size_t count, size_t size) DECLSPEC_HIDDEN;
 
-static inline const char *debugstr_time(REFERENCE_TIME time)
-{
-    ULONGLONG abstime = time >= 0 ? time : -time;
-    unsigned int i = 0, j = 0;
-    char buffer[23], rev[23];
-
-    while (abstime || i <= 8)
-    {
-        buffer[i++] = '0' + (abstime % 10);
-        abstime /= 10;
-        if (i == 7) buffer[i++] = '.';
-    }
-    if (time < 0) buffer[i++] = '-';
-
-    while (i--) rev[j++] = buffer[i];
-    while (rev[j-1] == '0' && rev[j-2] != '.') --j;
-    rev[j] = 0;
-
-    return wine_dbg_sprintf("%s", rev);
-}
-
 #define MEDIATIME_FROM_BYTES(x) ((LONGLONG)(x) * 10000000)
 
 struct wg_parser *wg_parser_create(enum wg_parser_type type, bool unlimited_buffering) DECLSPEC_HIDDEN;
diff --git a/dlls/winegstreamer/quartz_parser.c b/dlls/winegstreamer/quartz_parser.c
index 331bc9a888a..704e782554e 100644
--- a/dlls/winegstreamer/quartz_parser.c
+++ b/dlls/winegstreamer/quartz_parser.c
@@ -1298,8 +1298,8 @@ static HRESULT WINAPI GST_Seeking_SetPositions(IMediaSeeking *iface,
     int i;
 
     TRACE("pin %p, current %s, current_flags %#lx, stop %s, stop_flags %#lx.\n",
-            pin, current ? debugstr_time(*current) : "<null>", current_flags,
-            stop ? debugstr_time(*stop) : "<null>", stop_flags);
+            pin, current ? wine_dbgstr_reference_time(*current) : "<null>", current_flags,
+            stop ? wine_dbgstr_reference_time(*stop) : "<null>", stop_flags);
 
     if (pin->pin.pin.filter->state == State_Stopped)
     {
@@ -1419,7 +1419,7 @@ static HRESULT WINAPI GST_QualityControl_Notify(IQualityControl *iface, IBaseFil
 
     TRACE("pin %p, sender %p, type %s, proportion %ld, late %s, timestamp %s.\n",
             pin, sender, q.Type == Famine ? "Famine" : "Flood", q.Proportion,
-            debugstr_time(q.Late), debugstr_time(q.TimeStamp));
+            wine_dbgstr_reference_time(q.Late), wine_dbgstr_reference_time(q.TimeStamp));
 
     /* DirectShow filters sometimes pass negative timestamps (Audiosurf uses the
      * current time instead of the time of the last buffer). GstClockTime is
diff --git a/dlls/winegstreamer/wm_asyncreader.c b/dlls/winegstreamer/wm_asyncreader.c
index fc919ef2c49..41c335210b8 100644
--- a/dlls/winegstreamer/wm_asyncreader.c
+++ b/dlls/winegstreamer/wm_asyncreader.c
@@ -319,7 +319,7 @@ static HRESULT WINAPI WMReader_Start(IWMReader *iface,
     static const DWORD zero;
 
     TRACE("reader %p, start %s, duration %s, rate %.8e, context %p.\n",
-            reader, debugstr_time(start), debugstr_time(duration), rate, context);
+            reader, wine_dbgstr_reference_time(start), wine_dbgstr_reference_time(duration), rate, context);
 
     if (rate != 1.0f)
         FIXME("Ignoring rate %.8e.\n", rate);
@@ -448,7 +448,7 @@ static HRESULT WINAPI WMReaderAdvanced_DeliverTime(IWMReaderAdvanced6 *iface, QW
 {
     struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
 
-    TRACE("reader %p, time %s.\n", reader, debugstr_time(time));
+    TRACE("reader %p, time %s.\n", reader, wine_dbgstr_reference_time(time));
 
     EnterCriticalSection(&reader->stream_cs);
 
@@ -1492,7 +1492,7 @@ static HRESULT WINAPI refclock_AdviseTime(IReferenceClock *iface, REFERENCE_TIME
     struct async_reader *reader = impl_from_IReferenceClock(iface);
 
     FIXME("reader %p, basetime %s, streamtime %s, event %#Ix, cookie %p, stub!\n",
-            reader, debugstr_time(basetime), debugstr_time(streamtime), event, cookie);
+            reader, wine_dbgstr_reference_time(basetime), wine_dbgstr_reference_time(streamtime), event, cookie);
 
     return E_NOTIMPL;
 }
@@ -1503,7 +1503,7 @@ static HRESULT WINAPI refclock_AdvisePeriodic(IReferenceClock *iface, REFERENCE_
     struct async_reader *reader = impl_from_IReferenceClock(iface);
 
     FIXME("reader %p, starttime %s, period %s, semaphore %#Ix, cookie %p, stub!\n",
-            reader, debugstr_time(starttime), debugstr_time(period), semaphore, cookie);
+            reader, wine_dbgstr_reference_time(starttime), wine_dbgstr_reference_time(period), semaphore, cookie);
 
     return E_NOTIMPL;
 }
diff --git a/dlls/winegstreamer/wm_reader.c b/dlls/winegstreamer/wm_reader.c
index d40afb66afd..4e14f03fb20 100644
--- a/dlls/winegstreamer/wm_reader.c
+++ b/dlls/winegstreamer/wm_reader.c
@@ -912,7 +912,7 @@ static HRESULT WINAPI profile_CreateNewStreamPrioritization(IWMProfile3 *iface,
 
 static HRESULT WINAPI profile_GetExpectedPacketCount(IWMProfile3 *iface, QWORD duration, QWORD *count)
 {
-    FIXME("iface %p, duration %s, count %p, stub!\n", iface, debugstr_time(duration), count);
+    FIXME("iface %p, duration %s, count %p, stub!\n", iface, wine_dbgstr_reference_time(duration), count);
     return E_NOTIMPL;
 }
 
@@ -1029,7 +1029,7 @@ static HRESULT WINAPI header_info_GetAttributeByName(IWMHeaderInfo3 *iface, WORD
         EnterCriticalSection(&reader->cs);
         duration = wg_parser_stream_get_duration(wg_parser_get_stream(reader->wg_parser, 0));
         LeaveCriticalSection(&reader->cs);
-        TRACE("Returning duration %s.\n", debugstr_time(duration));
+        TRACE("Returning duration %s.\n", wine_dbgstr_reference_time(duration));
         memcpy(value, &duration, sizeof(QWORD));
         return S_OK;
     }
@@ -1084,7 +1084,7 @@ static HRESULT WINAPI header_info_GetMarker(IWMHeaderInfo3 *iface,
 
 static HRESULT WINAPI header_info_AddMarker(IWMHeaderInfo3 *iface, const WCHAR *name, QWORD time)
 {
-    FIXME("iface %p, name %s, time %s, stub!\n", iface, debugstr_w(name), debugstr_time(time));
+    FIXME("iface %p, name %s, time %s, stub!\n", iface, debugstr_w(name), wine_dbgstr_reference_time(time));
     return E_NOTIMPL;
 }
 
@@ -1112,7 +1112,7 @@ static HRESULT WINAPI header_info_AddScript(IWMHeaderInfo3 *iface,
         const WCHAR *type, const WCHAR *command, QWORD time)
 {
     FIXME("iface %p, type %s, command %s, time %s, stub!\n",
-            iface, debugstr_w(type), debugstr_w(command), debugstr_time(time));
+            iface, debugstr_w(type), debugstr_w(command), wine_dbgstr_reference_time(time));
     return E_NOTIMPL;
 }
 
diff --git a/include/wine/debug.h b/include/wine/debug.h
index 58f92754164..566fb185745 100644
--- a/include/wine/debug.h
+++ b/include/wine/debug.h
@@ -349,6 +349,27 @@ static inline const char *wine_dbgstr_longlong( ULONGLONG ll )
     else return wine_dbg_sprintf( "%lx", (unsigned long)ll );
 }
 
+static inline const char *wine_dbgstr_reference_time( LONGLONG time )
+{
+    ULONGLONG abstime = time >= 0 ? time : -time;
+    unsigned int i = 0, j = 0;
+    char buffer[23], rev[23];
+
+    while (abstime || i <= 8)
+    {
+        buffer[i++] = '0' + (abstime % 10);
+        abstime /= 10;
+        if (i == 7) buffer[i++] = '.';
+    }
+    if (time < 0) buffer[i++] = '-';
+
+    while (i--) rev[j++] = buffer[i];
+    while (rev[j-1] == '0' && rev[j-2] != '.') --j;
+    rev[j] = 0;
+
+    return wine_dbg_sprintf("%s", rev);
+}
+
 #if defined(__oaidl_h__) && defined(V_VT)
 
 static inline const char *wine_dbgstr_vt( VARTYPE vt )
diff --git a/libs/strmbase/filter.c b/libs/strmbase/filter.c
index 2cf874ac1f1..9b9e05223d0 100644
--- a/libs/strmbase/filter.c
+++ b/libs/strmbase/filter.c
@@ -347,7 +347,7 @@ static HRESULT WINAPI filter_Run(IBaseFilter *iface, REFERENCE_TIME start)
     struct strmbase_filter *filter = impl_from_IBaseFilter(iface);
     HRESULT hr = S_OK;
 
-    TRACE("filter %p %s, start %s.\n", filter, debugstr_w(filter->name), debugstr_time(start));
+    TRACE("filter %p %s, start %s.\n", filter, debugstr_w(filter->name), wine_dbgstr_reference_time(start));
 
     EnterCriticalSection(&filter->filter_cs);
 
diff --git a/libs/strmbase/mediatype.c b/libs/strmbase/mediatype.c
index 6f66999c390..e0618d06acb 100644
--- a/libs/strmbase/mediatype.c
+++ b/libs/strmbase/mediatype.c
@@ -109,7 +109,7 @@ void strmbase_dump_media_type(const AM_MEDIA_TYPE *mt)
         if (!IsRectEmpty(&vih->rcTarget)) TRACE("target %s, ", wine_dbgstr_rect(&vih->rcTarget));
         if (vih->dwBitRate) TRACE("bitrate %u, ", vih->dwBitRate);
         if (vih->dwBitErrorRate) TRACE("error rate %u, ", vih->dwBitErrorRate);
-        TRACE("%s sec/frame, ", debugstr_time(vih->AvgTimePerFrame));
+        TRACE("%s sec/frame, ", wine_dbgstr_reference_time(vih->AvgTimePerFrame));
         TRACE("size %dx%d, %u planes, %u bpp, compression %s, image size %u",
                 vih->bmiHeader.biWidth, vih->bmiHeader.biHeight, vih->bmiHeader.biPlanes,
                 vih->bmiHeader.biBitCount, debugstr_fourcc(vih->bmiHeader.biCompression),
@@ -128,7 +128,7 @@ void strmbase_dump_media_type(const AM_MEDIA_TYPE *mt)
         if (!IsRectEmpty(&vih->rcTarget)) TRACE("target %s, ", wine_dbgstr_rect(&vih->rcTarget));
         if (vih->dwBitRate) TRACE("bitrate %u, ", vih->dwBitRate);
         if (vih->dwBitErrorRate) TRACE("error rate %u, ", vih->dwBitErrorRate);
-        TRACE("%s sec/frame, ", debugstr_time(vih->AvgTimePerFrame));
+        TRACE("%s sec/frame, ", wine_dbgstr_reference_time(vih->AvgTimePerFrame));
         if (vih->dwInterlaceFlags) TRACE("interlace flags %#x, ", vih->dwInterlaceFlags);
         if (vih->dwCopyProtectFlags) TRACE("copy-protection flags %#x, ", vih->dwCopyProtectFlags);
         TRACE("aspect ratio %u/%u, ", vih->dwPictAspectRatioX, vih->dwPictAspectRatioY);
diff --git a/libs/strmbase/pin.c b/libs/strmbase/pin.c
index 36b3fdf1425..cb958099d38 100644
--- a/libs/strmbase/pin.c
+++ b/libs/strmbase/pin.c
@@ -650,7 +650,7 @@ static HRESULT WINAPI source_NewSegment(IPin * iface, REFERENCE_TIME start, REFE
     struct strmbase_source *pin = impl_source_from_IPin(iface);
 
     TRACE("pin %p %s:%s, start %s, stop %s, rate %.16e.\n", pin, debugstr_w(pin->pin.filter->name),
-            debugstr_w(pin->pin.name), debugstr_time(start), debugstr_time(stop), rate);
+            debugstr_w(pin->pin.name), wine_dbgstr_reference_time(start), wine_dbgstr_reference_time(stop), rate);
 
     return S_OK;
 }
@@ -1019,7 +1019,7 @@ static HRESULT WINAPI sink_NewSegment(IPin *iface, REFERENCE_TIME start, REFEREN
     newsegmentargs args;
 
     TRACE("pin %p %s:%s, start %s, stop %s, rate %.16e.\n", pin, debugstr_w(pin->pin.filter->name),
-            debugstr_w(pin->pin.name), debugstr_time(start), debugstr_time(stop), rate);
+            debugstr_w(pin->pin.name), wine_dbgstr_reference_time(start), wine_dbgstr_reference_time(stop), rate);
 
     if (pin->pFuncsTable->sink_new_segment)
         return pin->pFuncsTable->sink_new_segment(pin, start, stop, rate);
diff --git a/libs/strmbase/renderer.c b/libs/strmbase/renderer.c
index da257555a19..70e3c78207a 100644
--- a/libs/strmbase/renderer.c
+++ b/libs/strmbase/renderer.c
@@ -107,11 +107,11 @@ static void perform_qos(struct strmbase_renderer *filter,
     }
 
     TRACE("start %s, entered %s, left %s, pt %s, duration %s, jitter %s.\n",
-            debugstr_time(start), debugstr_time(entered), debugstr_time(left),
-            debugstr_time(pt), debugstr_time(duration), debugstr_time(jitter));
+            wine_dbgstr_reference_time(start), wine_dbgstr_reference_time(entered), wine_dbgstr_reference_time(left),
+            wine_dbgstr_reference_time(pt), wine_dbgstr_reference_time(duration), wine_dbgstr_reference_time(jitter));
 
     TRACE("average duration %s, average pt %s, average rate %.16e.\n",
-            debugstr_time(filter->avg_duration), debugstr_time(filter->avg_pt), filter->avg_rate);
+            wine_dbgstr_reference_time(filter->avg_duration), wine_dbgstr_reference_time(filter->avg_pt), filter->avg_rate);
 
     /* Collect running averages. For first observations, we copy the values. */
     if (filter->avg_duration < 0)
@@ -527,7 +527,7 @@ static HRESULT WINAPI quality_control_Notify(IQualityControl *iface, IBaseFilter
     HRESULT hr = S_FALSE;
 
     TRACE("filter %p, sender %p, type %#x, proportion %u, late %s, timestamp %s.\n",
-            filter, sender, q.Type, q.Proportion, debugstr_time(q.Late), debugstr_time(q.TimeStamp));
+            filter, sender, q.Type, q.Proportion, wine_dbgstr_reference_time(q.Late), wine_dbgstr_reference_time(q.TimeStamp));
 
     if (filter->qc_sink)
         return IQualityControl_Notify(filter->qc_sink, &filter->filter.IBaseFilter_iface, q);
diff --git a/libs/strmbase/strmbase_private.h b/libs/strmbase/strmbase_private.h
index 9ac0b24bb1a..ad9da316c2c 100644
--- a/libs/strmbase/strmbase_private.h
+++ b/libs/strmbase/strmbase_private.h
@@ -32,25 +32,4 @@
 #include "wine/list.h"
 #include "wine/strmbase.h"
 
-static inline const char *debugstr_time(REFERENCE_TIME time)
-{
-    ULONGLONG abstime = time >= 0 ? time : -time;
-    unsigned int i = 0, j = 0;
-    char buffer[23], rev[23];
-
-    while (abstime || i <= 8)
-    {
-        buffer[i++] = '0' + (abstime % 10);
-        abstime /= 10;
-        if (i == 7) buffer[i++] = '.';
-    }
-    if (time < 0) buffer[i++] = '-';
-
-    while (i--) rev[j++] = buffer[i];
-    while (rev[j-1] == '0' && rev[j-2] != '.') --j;
-    rev[j] = 0;
-
-    return wine_dbg_sprintf("%s", rev);
-}
-
 #endif /* __WINE_STRMBASE_PRIVATE_H */
-- 
2.35.1





More information about the wine-devel mailing list