Code Review
/
sim
/
o1-interface.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Add blank type of NTS.
[sim/o1-interface.git]
/
ntsimulator
/
ntsim-ng
/
utils
/
rand_utils.c
diff --git
a/ntsimulator/ntsim-ng/utils/rand_utils.c
b/ntsimulator/ntsim-ng/utils/rand_utils.c
index
06d746c
..
296daa8
100644
(file)
--- a/
ntsimulator/ntsim-ng/utils/rand_utils.c
+++ b/
ntsimulator/ntsim-ng/utils/rand_utils.c
@@
-880,13
+880,15
@@
static rand_range_t rand_range(const char *range, const LY_DATA_TYPE type) {
}
static char *rand_date_and_time(void) {
}
static char *rand_date_and_time(void) {
- time_t t = rand_uint32() / 2;
+ time_t now = time(0);
+ time_t start_date = 1577836800; //2020-01-01T00:00:00Z
+
+ time_t t = start_date + rand_uint32() % (now - start_date);
struct tm lt;
(void)localtime_r(&t, <);
char *ret = (char *)malloc(21);
if(!ret) {
struct tm lt;
(void)localtime_r(&t, <);
char *ret = (char *)malloc(21);
if(!ret) {
- log_error("bad malloc\n");
return 0;
}
strftime(ret, 21, "%Y-%m-%dT%H:%M:%SZ", <);
return 0;
}
strftime(ret, 21, "%Y-%m-%dT%H:%M:%SZ", <);