aboutsummaryrefslogtreecommitdiff
path: root/sbin/devd/devd.cc
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2016-04-03 20:29:21 +0000
committerWarner Losh <imp@FreeBSD.org>2016-04-03 20:29:21 +0000
commit3b336ac34ffde831093cad2f4ae4ad42e9284dc5 (patch)
treee1e253b9c6db21c42955d15e67c45718f77b5f0b /sbin/devd/devd.cc
parent535595db8d52ab8f9bb0154675336725adf67319 (diff)
Notes
Diffstat (limited to 'sbin/devd/devd.cc')
-rw-r--r--sbin/devd/devd.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/sbin/devd/devd.cc b/sbin/devd/devd.cc
index 367783f87294..b2aea194973c 100644
--- a/sbin/devd/devd.cc
+++ b/sbin/devd/devd.cc
@@ -788,6 +788,8 @@ process_event(char *buffer)
{
char type;
char *sp;
+ struct timeval tv;
+ char *timestr;
sp = buffer + 1;
devdlog(LOG_INFO, "Processing event '%s'\n", buffer);
@@ -797,7 +799,15 @@ process_event(char *buffer)
cfg.set_variable("*", buffer - 1);
// $_ is the entire line without the initial character
cfg.set_variable("_", buffer);
- // No match doesn't have a device, and the format is a little
+
+ // Save the time this happened (as approximated by when we got
+ // around to processing it).
+ gettimeofday(&tv, NULL);
+ asprintf(&timestr, "%jd.%06ld", (uintmax_t)tv.tv_sec, tv.tv_usec);
+ cfg.set_variable("timestamp", timestr);
+ free(timestr);
+
+ // Match doesn't have a device, and the format is a little
// different, so handle it separately.
switch (type) {
case notify: