Browse Source

faux.time: faux_timespec_now[_monotonic]() returns bool_t instead int

Serj Kalichev 3 years ago
parent
commit
ced90eebb7
2 changed files with 10 additions and 10 deletions
  1. 2 2
      faux/time.h
  2. 8 8
      faux/time/time.c

+ 2 - 2
faux/time.h

@@ -19,8 +19,8 @@ bool_t faux_timespec_diff(struct timespec *res,
 	const struct timespec *val1, const struct timespec *val2);
 bool_t faux_timespec_sum(struct timespec *res,
 	const struct timespec *val1, const struct timespec *val2);
-int faux_timespec_now(struct timespec *now);
-int faux_timespec_now_monotonic(struct timespec *now);
+bool_t faux_timespec_now(struct timespec *now);
+bool_t faux_timespec_now_monotonic(struct timespec *now);
 bool_t faux_timespec_before_now(const struct timespec *ts);
 
 // Convertions of struct timespec

+ 8 - 8
faux/time/time.c

@@ -141,17 +141,17 @@ void faux_nsec_to_timespec(struct timespec *ts, uint64_t nsec)
 /** @brief Returns current time (now).
  *
  * @param [out] now The struct timespec to save current time.
- * @return 0 - success, < 0 on error.
+ * @return BOOL_TRUE - success, BOOL_FALSE on error.
  */
-int faux_timespec_now(struct timespec *now)
+bool_t faux_timespec_now(struct timespec *now)
 {
 	assert(now);
 	if (!now)
-		return -1;
+		return BOOL_FALSE;
 
 	clock_gettime(CLOCK_REALTIME, now);
 
-	return 0;
+	return BOOL_TRUE;
 }
 
 
@@ -161,17 +161,17 @@ int faux_timespec_now(struct timespec *now)
  * time from system up but not since Epoch.
  *
  * @param [out] now The struct timespec to save current time.
- * @return 0 - success, < 0 on error.
+ * @return BOOL_TRUE success, BOOL_FALSE on error.
  */
-int faux_timespec_now_monotonic(struct timespec *now)
+bool_t faux_timespec_now_monotonic(struct timespec *now)
 {
 	assert(now);
 	if (!now)
-		return -1;
+		return BOOL_FALSE;
 
 	clock_gettime(CLOCK_MONOTONIC, now);
 
-	return 0;
+	return BOOL_TRUE;
 }