summaryrefslogtreecommitdiffstats
path: root/src/vpp-api
diff options
context:
space:
mode:
Diffstat (limited to 'src/vpp-api')
-rw-r--r--src/vpp-api/python/vpp_papi/vpp_format.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/vpp-api/python/vpp_papi/vpp_format.py b/src/vpp-api/python/vpp_papi/vpp_format.py
index b58dad3c1b5..7d2dcba491a 100644
--- a/src/vpp-api/python/vpp_papi/vpp_format.py
+++ b/src/vpp-api/python/vpp_papi/vpp_format.py
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-
+import datetime
from socket import inet_pton, AF_INET6, AF_INET
import socket
import ipaddress
@@ -117,6 +117,11 @@ conversion_table = {
'MACAddress': lambda o: o.packed,
'str': lambda s: macaddress.mac_pton(s)
},
+ 'vl_api_timestamp_t':
+ {
+ 'datetime.datetime': lambda o:
+ (o - datetime.datetime(1970, 1, 1)).total_seconds()
+ }
}
@@ -142,4 +147,6 @@ conversion_unpacker_table = {
'vl_api_address_t': lambda o: unformat_api_address_t(o),
'vl_api_prefix_t': lambda o: unformat_api_prefix_t(o),
'vl_api_mac_address_t': lambda o: macaddress.MACAddress(o),
+ 'vl_api_timestamp_t': lambda o: datetime.datetime.fromtimestamp(o),
+ 'vl_api_timedelta_t': lambda o: datetime.timedelta(seconds=o),
}