cleanup: remove duplicated NSEC_PER_SEC macros

This switches everything to using a single 64-bit constant for NSEC_PER_SEC
that ensure we're doing 64-bit math everywhere.
This commit is contained in:
Christian Hergert
2019-07-18 10:22:46 -07:00
parent 991e03ba67
commit c2728b8ada
9 changed files with 42 additions and 53 deletions

View File

@ -28,8 +28,6 @@
#include "sysprof-log-model.h"
#define NSEC_PER_SEC (G_USEC_PER_SEC * 1000L)
struct _SysprofLogModel
{
GObject parent_instance;
@ -189,9 +187,9 @@ sysprof_log_model_get_value (GtkTreeModel *model,
case SYSPROF_LOG_MODEL_COLUMN_TIME_STRING:
{
gint64 offset = item->time - self->begin_time;
gint min = offset / (NSEC_PER_SEC * 60L);
gint seconds = (offset - (min * NSEC_PER_SEC)) / NSEC_PER_SEC;
gint msec = (offset % NSEC_PER_SEC) / (NSEC_PER_SEC / 1000L);
gint min = offset / SYSPROF_NSEC_PER_SEC / 60L;
gint seconds = (offset - (min * SYSPROF_NSEC_PER_SEC)) / SYSPROF_NSEC_PER_SEC;
gint msec = (offset % SYSPROF_NSEC_PER_SEC) / (SYSPROF_NSEC_PER_SEC / 1000L);
g_value_init (value, G_TYPE_STRING);
g_value_take_string (value,