common.hpp: time: Added typedef for Milliseconds and MillisecondsSince1970, and use instead of double where appropriate.
diff --git a/ndn-cpp/c/data.h b/ndn-cpp/c/data.h
index 8d14e05..68ed6ed 100644
--- a/ndn-cpp/c/data.h
+++ b/ndn-cpp/c/data.h
@@ -46,10 +46,10 @@
* An ndn_MetaInfo struct holds the meta info which is signed inside the data packet.
*/
struct ndn_MetaInfo {
- double timestampMilliseconds; /**< milliseconds since 1/1/1970. -1 for none */
- ndn_ContentType type; /**< default is ndn_ContentType_DATA. -1 for none */
- int freshnessSeconds; /**< -1 for none */
- struct ndn_NameComponent finalBlockID; /**< has a pointer to a pre-allocated buffer. 0 for none */
+ ndn_MillisecondsSince1970 timestampMilliseconds; /**< milliseconds since 1/1/1970. -1 for none */
+ ndn_ContentType type; /**< default is ndn_ContentType_DATA. -1 for none */
+ int freshnessSeconds; /**< -1 for none */
+ struct ndn_NameComponent finalBlockID; /**< has a pointer to a pre-allocated buffer. 0 for none */
};
/**
diff --git a/ndn-cpp/c/interest.h b/ndn-cpp/c/interest.h
index 12ca38e..438fecd 100644
--- a/ndn-cpp/c/interest.h
+++ b/ndn-cpp/c/interest.h
@@ -99,7 +99,7 @@
int childSelector; /**< -1 for none */
int answerOriginKind; /**< -1 for none */
int scope; /**< -1 for none */
- double interestLifetimeMilliseconds; /**< milliseconds. -1.0 for none */
+ ndn_Milliseconds interestLifetimeMilliseconds; /**< milliseconds. -1.0 for none */
struct ndn_Blob nonce; /**< The blob whose value is a pointer to a pre-allocated buffer. 0 for none */
};
diff --git a/ndn-cpp/c/util/time.c b/ndn-cpp/c/util/time.c
index a794047..9da0e1c 100644
--- a/ndn-cpp/c/util/time.c
+++ b/ndn-cpp/c/util/time.c
@@ -7,7 +7,7 @@
#include <sys/time.h>
#include "time.h"
-double
+ndn_MillisecondsSince1970
ndn_getNowMilliseconds()
{
struct timeval t;
diff --git a/ndn-cpp/c/util/time.h b/ndn-cpp/c/util/time.h
index 36b4dad..adcb0b4 100644
--- a/ndn-cpp/c/util/time.h
+++ b/ndn-cpp/c/util/time.h
@@ -7,6 +7,8 @@
#ifndef NDN_TIME_H
#define NDN_TIME_H
+#include <ndn-cpp/c/common.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -15,7 +17,7 @@
* Use gettimeofday to return the current time in milliseconds.
* @return The current time in milliseconds since 1/1/1970, including fractions of a millisecond according to timeval.tv_usec.
*/
-double
+ndn_MillisecondsSince1970
ndn_getNowMilliseconds();
#ifdef __cplusplus