comparison sat/tools/utils.py @ 4033:5a42c7842556

core (plugins): implementation of XEP-0215 "External Service Discovery": rel 418
author Goffi <goffi@goffi.org>
date Fri, 07 Apr 2023 15:16:39 +0200
parents 8179cff7ef5c
children 524856bd7b19
comparison
equal deleted inserted replaced
4032:bb211f80c3e6 4033:5a42c7842556
171 171
172 @param xmpp_date_str: XEP-0082 formatted datetime or time 172 @param xmpp_date_str: XEP-0082 formatted datetime or time
173 @param with_time: if True, ``xmpp_date_str`` must be a datetime, otherwise if must be 173 @param with_time: if True, ``xmpp_date_str`` must be a datetime, otherwise if must be
174 a time profile. 174 a time profile.
175 @return: datetime converted to unix time 175 @return: datetime converted to unix time
176 @raise ValueError: the format is invalid
176 """ 177 """
177 if with_time: 178 if with_time:
178 dt = xmpp_datetime.parse_datetime(xmpp_date_str) 179 dt = xmpp_datetime.parse_datetime(xmpp_date_str)
179 else: 180 else:
180 d = xmpp_datetime.parse_date(xmpp_date_str) 181 d = xmpp_datetime.parse_date(xmpp_date_str)