summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 965246d)
raw | patch | inline | side by side (parent: 965246d)
author | Florian Forster <octo@huhu.verplant.org> | |
Tue, 16 Nov 2010 08:20:04 +0000 (09:20 +0100) | ||
committer | Florian Forster <octo@huhu.verplant.org> | |
Tue, 16 Nov 2010 08:20:04 +0000 (09:20 +0100) |
src/network.c | patch | blob | history | |
src/network.h | patch | blob | history |
diff --git a/src/network.c b/src/network.c
index 43193cfca250093849a918b547904fc7f999981e..eb32ad15081e811079fe864a1d999e0d09a4d77a 100644 (file)
--- a/src/network.c
+++ b/src/network.c
if (status == 0)
{
vl.time = TIME_T_TO_CDTIME_T (tmp);
- n.time = TIME_T_TO_CDTIME_T (tmp);
+ n.time = TIME_T_TO_CDTIME_T (tmp);
+ }
+ }
+ else if (pkg_type == TYPE_TIME_HR)
+ {
+ uint64_t tmp = 0;
+ status = parse_part_number (&buffer, &buffer_size,
+ &tmp);
+ if (status == 0)
+ {
+ vl.time = (cdtime_t) tmp;
+ n.time = (cdtime_t) tmp;
}
}
else if (pkg_type == TYPE_INTERVAL)
if (status == 0)
vl.interval = TIME_T_TO_CDTIME_T (tmp);
}
+ else if (pkg_type == TYPE_INTERVAL_HR)
+ {
+ uint64_t tmp = 0;
+ status = parse_part_number (&buffer, &buffer_size,
+ &tmp);
+ if (status == 0)
+ vl.interval = (cdtime_t) tmp;
+ }
else if (pkg_type == TYPE_HOST)
{
status = parse_part_string (&buffer, &buffer_size,
if (vl_def->time != vl->time)
{
- time_t tmp = CDTIME_T_TO_TIME_T (vl->time);
- if (write_part_number (&buffer, &buffer_size, TYPE_TIME,
- (uint64_t) tmp))
+ if (write_part_number (&buffer, &buffer_size, TYPE_TIME_HR,
+ (uint64_t) vl->time))
return (-1);
vl_def->time = vl->time;
}
if (vl_def->interval != vl->interval)
{
- /* TODO: Create a new type for sub-second intervals. */
- if (write_part_number (&buffer, &buffer_size, TYPE_INTERVAL,
- (uint64_t) CDTIME_T_TO_TIME_T (vl->interval)))
+ if (write_part_number (&buffer, &buffer_size, TYPE_INTERVAL_HR,
+ (uint64_t) vl->interval))
return (-1);
vl_def->interval = vl->interval;
}
char *buffer_ptr = buffer;
int buffer_free = sizeof (buffer);
int status;
- time_t tmp;
memset (buffer, '\0', sizeof (buffer));
-
- tmp = CDTIME_T_TO_TIME_T (n->time);
- status = write_part_number (&buffer_ptr, &buffer_free, TYPE_TIME,
- (uint64_t) tmp);
+ status = write_part_number (&buffer_ptr, &buffer_free, TYPE_TIME_HR,
+ (uint64_t) n->time);
if (status != 0)
return (-1);
diff --git a/src/network.h b/src/network.h
index 777616c4725cc75ddb13f9844e5c833aa81e7e35..1b354561ec7e8a2ab6e7a29cb1f6106445cca28f 100644 (file)
--- a/src/network.h
+++ b/src/network.h
#define TYPE_HOST 0x0000
#define TYPE_TIME 0x0001
+#define TYPE_TIME_HR 0x0008
#define TYPE_PLUGIN 0x0002
#define TYPE_PLUGIN_INSTANCE 0x0003
#define TYPE_TYPE 0x0004
#define TYPE_TYPE_INSTANCE 0x0005
#define TYPE_VALUES 0x0006
#define TYPE_INTERVAL 0x0007
+#define TYPE_INTERVAL_HR 0x0009
/* Types to transmit notifications */
#define TYPE_MESSAGE 0x0100