[ONOS-6322] - Use event timestamp in GossipDeviceStore when marking devices offline in response to gossip messages on standby nodes.

Change-Id: Id6fea7f9eb143af5b28d455d3f217fcea97b941f
diff --git a/core/store/dist/src/main/java/org/onosproject/store/device/impl/GossipDeviceStore.java b/core/store/dist/src/main/java/org/onosproject/store/device/impl/GossipDeviceStore.java
index 33f131e..267ee48 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/device/impl/GossipDeviceStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/device/impl/GossipDeviceStore.java
@@ -398,7 +398,7 @@
             if (oldDevice == null) {
                 // REGISTER
                 if (!deltaDesc.value().isDefaultAvailable()) {
-                    return registerDevice(providerId, newDevice);
+                    return registerDevice(providerId, newDevice, deltaDesc.timestamp());
                 }
                 // ADD
                 return createDevice(providerId, newDevice, deltaDesc.timestamp());
@@ -467,7 +467,7 @@
         return event;
     }
 
-    private DeviceEvent registerDevice(ProviderId providerId, Device newDevice) {
+    private DeviceEvent registerDevice(ProviderId providerId, Device newDevice, Timestamp newTimestamp) {
         // update composed device cache
         Device oldDevice = devices.putIfAbsent(newDevice.id(), newDevice);
         verify(oldDevice == null,
@@ -475,7 +475,7 @@
                providerId, oldDevice, newDevice);
 
         if (!providerId.isAncillary()) {
-            markOffline(newDevice.id());
+            markOffline(newDevice.id(), newTimestamp);
         }
 
         return new DeviceEvent(DeviceEvent.Type.DEVICE_ADDED, newDevice, null);
@@ -483,7 +483,10 @@
 
     @Override
     public DeviceEvent markOffline(DeviceId deviceId) {
-        final Timestamp timestamp = deviceClockService.getTimestamp(deviceId);
+        return markOffline(deviceId, deviceClockService.getTimestamp(deviceId));
+    }
+
+    private DeviceEvent markOffline(DeviceId deviceId, Timestamp timestamp) {
         final DeviceEvent event = markOfflineInternal(deviceId, timestamp);
         if (event != null) {
             log.debug("Notifying peers of a device offline topology event for deviceId: {} {}",