MCPcopy Index your code
hub / github.com/googlemaps/google-maps-services-python / time

Function time

googlemaps/convert.py:175–192  ·  view source on GitHub ↗

Converts the value into a unix time (seconds since unix epoch). For example: convert.time(datetime.now()) # '1409810596' :param arg: The time. :type arg: datetime.datetime or int

(arg)

Source from the content-addressed store, hash-verified

173
174
175def time(arg):
176 """Converts the value into a unix time (seconds since unix epoch).
177
178 For example:
179 convert.time(datetime.now())
180 # '1409810596'
181
182 :param arg: The time.
183 :type arg: datetime.datetime or int
184 """
185 # handle datetime instances.
186 if _has_method(arg, "timestamp"):
187 arg = arg.timestamp()
188
189 if isinstance(arg, float):
190 arg = int(arg)
191
192 return str(arg)
193
194
195def _has_method(arg, method):

Callers

nothing calls this directly

Calls 1

_has_methodFunction · 0.85

Tested by

no test coverage detected