aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples/add_person.cc
diff options
context:
space:
mode:
Diffstat (limited to 'examples/add_person.cc')
-rw-r--r--examples/add_person.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/examples/add_person.cc b/examples/add_person.cc
index 9bec4b37..856e90bb 100644
--- a/examples/add_person.cc
+++ b/examples/add_person.cc
@@ -1,11 +1,17 @@
// See README.txt for information and build instructions.
-#include <iostream>
+#include <ctime>
#include <fstream>
+#include <google/protobuf/util/time_util.h>
+#include <iostream>
#include <string>
+
#include "addressbook.pb.h"
+
using namespace std;
+using google::protobuf::util::TimeUtil;
+
// This function fills in a Person message based on user input.
void PromptForAddress(tutorial::Person* person) {
cout << "Enter person ID number: ";
@@ -48,6 +54,7 @@ void PromptForAddress(tutorial::Person* person) {
cout << "Unknown phone type. Using default." << endl;
}
}
+ *person->mutable_last_updated() = TimeUtil::SecondsToTimestamp(time(NULL));
}
// Main function: Reads the entire address book from a file,