From 74bf45f379b35e1d103940f35d7a04545b0235d4 Mon Sep 17 00:00:00 2001 From: Feng Xiao Date: Fri, 8 Sep 2017 15:44:09 -0700 Subject: Add bazel support for examples. The example utilizes native bazel rules (proto_library, cc_proto_library, java_proto_library, java_lite_proto_library) to show how easy it is to build protobuf with bazel's native support. It also makes use of well known types which was not possible until the latest bazel 0.5.4 release and https://github.com/google/protobuf/pull/3594 . --- examples/add_person.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'examples/add_person.cc') 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 +#include #include +#include +#include #include + #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, -- cgit v1.2.3