]> git.alsa-project.org Git - alsa-gobject.git/commitdiff
timer: instance_status: unify two arguments to single argument for timestamp
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Sat, 13 Jun 2020 05:01:36 +0000 (14:01 +0900)
committer坂本 貴史 <o-takashi@sakamocchi.jp>
Sat, 13 Jun 2020 07:41:04 +0000 (16:41 +0900)
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
src/timer/instance-status.c
src/timer/instance-status.h

index 3685b13942d978bb3642730d8fc49a9a6d7d2c67..16ee34c2b9234ea0e6d08a5d1d874a668b1ca855 100644 (file)
@@ -18,6 +18,7 @@
  */
 struct _ALSATimerInstanceStatusPrivate {
     struct snd_timer_status status;
+    gint64 tstamp[2];
 };
 G_DEFINE_TYPE_WITH_PRIVATE(ALSATimerInstanceStatus, alsatimer_instance_status, G_TYPE_OBJECT)
 
@@ -103,24 +104,25 @@ static void alsatimer_instance_status_init(ALSATimerInstanceStatus *self)
 /**
  * alsatimer_instance_status_get_tstamp:
  * @self: A #ALSATimerInstanceStatus.
- * @tv_sec: (out): The second part of timestamp.
- * @tv_nsec: (out): The nano second part of timerstamp.
+ * @tstamp: (array fixed-size=2)(out)(transfer none): The array with two
+ *          elements for the seconds and nanoseconds parts of timestamp
+ *          when the instance queues the latest event.
  *
- * Get timestamp for the latest update.
+ * Get timestamp for the latest event.
  */
 void alsatimer_instance_status_get_tstamp(ALSATimerInstanceStatus *self,
-                                          guint *tv_sec, guint *tv_nsec)
+                                          const gint64 *tstamp[2])
 {
     ALSATimerInstanceStatusPrivate *priv;
 
     g_return_if_fail(ALSATIMER_IS_INSTANCE_STATUS(self));
-    g_return_if_fail(tv_sec != NULL);
-    g_return_if_fail(tv_nsec != NULL);
+    g_return_if_fail(tstamp != NULL);
     priv = alsatimer_instance_status_get_instance_private(self);
 
-    *tv_sec = (guint)priv->status.tstamp.tv_sec;
-    *tv_nsec = (guint)priv->status.tstamp.tv_nsec;
+    priv->tstamp[0] = (gint64)priv->status.tstamp.tv_sec;
+    priv->tstamp[1] = (gint64)priv->status.tstamp.tv_nsec;
 
+    *tstamp = (const gint64 *)&priv->tstamp;
 }
 
 void timer_instance_status_refer_private(ALSATimerInstanceStatus *self,
index 41d895bb296397823c8308b18559ea3af7c83fda..13bd4177d2ffacfb3258c5c10f9a80d6820abb5e 100644 (file)
@@ -46,7 +46,7 @@ struct _ALSATimerInstanceStatusClass {
 GType alsatimer_instance_status_get_type() G_GNUC_CONST;
 
 void alsatimer_instance_status_get_tstamp(ALSATimerInstanceStatus *self,
-                                          guint *tv_sec, guint *tv_nsec);
+                                          const gint64 *tstamp[2]);
 
 G_END_DECLS