MCPcopy Create free account
hub / github.com/seleniumbase/SeleniumBase / get_master_time

Function get_master_time

seleniumbase/core/log_helper.py:54–87  ·  view source on GitHub ↗

Returns (timestamp, the_date, the_time)

()

Source from the content-addressed store, hash-verified

52
53
54def get_master_time():
55 """Returns (timestamp, the_date, the_time)"""
56 import datetime
57
58 timestamp = str(int(time.time())) + " (Unix Timestamp)"
59 now = datetime.datetime.now()
60 utc_offset = -time.timezone / 3600.0
61 utc_offset += time.daylight
62 utc_str = "UTC+0"
63 if utc_offset > 0:
64 if utc_offset < 10:
65 utc_str = "UTC+0%s" % utc_offset
66 else:
67 utc_str = "UTC+%s" % utc_offset
68 elif utc_offset < 0:
69 if utc_offset > -10:
70 utc_str = "UTC-0%s" % abs(utc_offset)
71 else:
72 utc_str = "UTC-%s" % abs(utc_offset)
73 utc_str = utc_str.replace(".5", ".3").replace(".", ":") + "0"
74 time_zone = ""
75 try:
76 time_zone = "(" + time.tzname[time.daylight] + ", " + utc_str + ")"
77 except Exception:
78 time_zone = "(" + utc_str + ")"
79 # Use [Day-of-Week, Month Day, Year] format when time zone < GMT/UTC-3
80 the_date = now.strftime("%A, %B %d, %Y").replace(" 0", " ")
81 if utc_offset >= -3:
82 # Use [Day-of-Week, Day Month Year] format when time zone >= GMT/UTC-3
83 the_date = now.strftime("%A, %d %B %Y").replace(" 0", " ")
84 the_time = now.strftime("%I:%M:%S %p ") + time_zone
85 if the_time.startswith("0"):
86 the_time = the_time[1:]
87 return timestamp, the_date, the_time
88
89
90def get_browser_version(driver):

Callers 2

log_test_failure_dataFunction · 0.85
log_skipped_test_dataFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…