timer: deprecate phosphor namespace
"phosphor" is a namespace used in some OpenBMC repositories but has
only one usage in sdbusplus and the class is not very OpenBMC-specific.
Move the Timer class into the sdbusplus namespace and mark
'phosphor::Timer' as a deprecated alias.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ia8c79a25755c9a2c4dc6f92bf1de8100622ef313
diff --git a/example/asio-example.cpp b/example/asio-example.cpp
index 474d261..08fcd11 100644
--- a/example/asio-example.cpp
+++ b/example/asio-example.cpp
@@ -362,9 +362,9 @@
"/xyz/openbmc_project/sensors", depth, interfaces);
// sd_events work too using the default event loop
- phosphor::Timer t1([]() { std::cerr << "*** tock ***\n"; });
+ sdbusplus::Timer t1([]() { std::cerr << "*** tock ***\n"; });
t1.start(std::chrono::microseconds(1000000));
- phosphor::Timer t2([]() { std::cerr << "*** tick ***\n"; });
+ sdbusplus::Timer t2([]() { std::cerr << "*** tick ***\n"; });
t2.start(std::chrono::microseconds(500000), true);
// add the sd_event wrapper to the io object
sdbusplus::asio::sd_event_wrapper sdEvents(io);
diff --git a/include/sdbusplus/timer.hpp b/include/sdbusplus/timer.hpp
index c9777c6..2127189 100644
--- a/include/sdbusplus/timer.hpp
+++ b/include/sdbusplus/timer.hpp
@@ -6,7 +6,7 @@
#include <functional>
#include <stdexcept>
-namespace phosphor
+namespace sdbusplus
{
/** @class Timer
@@ -246,4 +246,10 @@
}
};
+} // namespace sdbusplus
+
+namespace phosphor
+{
+// Deprecated name alias.
+using sdbusplus::Timer;
} // namespace phosphor
diff --git a/test/timer.cpp b/test/timer.cpp
index 26ad992..58ff2a1 100644
--- a/test/timer.cpp
+++ b/test/timer.cpp
@@ -5,7 +5,7 @@
#include <gtest/gtest.h>
-using namespace phosphor;
+using sdbusplus::Timer;
class TimerTest : public ::testing::Test
{