Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(143)

Unified Diff: third_party/tlslite/tlslite/utils/dateFuncs.py

Issue 211173006: Perform tlslite 0.3.8 -> 0.4.6 renames ahead of time. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Drop the -B Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/tlslite/tlslite/utils/dateFuncs.py
diff --git a/third_party/tlslite/tlslite/utils/dateFuncs.py b/third_party/tlslite/tlslite/utils/dateFuncs.py
deleted file mode 100644
index 38812ebf853cf5737f926ea6fc425c40e191e8c7..0000000000000000000000000000000000000000
--- a/third_party/tlslite/tlslite/utils/dateFuncs.py
+++ /dev/null
@@ -1,75 +0,0 @@
-
-import os
-
-#Functions for manipulating datetime objects
-#CCYY-MM-DDThh:mm:ssZ
-def parseDateClass(s):
- year, month, day = s.split("-")
- day, tail = day[:2], day[2:]
- hour, minute, second = tail[1:].split(":")
- second = second[:2]
- year, month, day = int(year), int(month), int(day)
- hour, minute, second = int(hour), int(minute), int(second)
- return createDateClass(year, month, day, hour, minute, second)
-
-
-if os.name != "java":
- from datetime import datetime, timedelta
-
- #Helper functions for working with a date/time class
- def createDateClass(year, month, day, hour, minute, second):
- return datetime(year, month, day, hour, minute, second)
-
- def printDateClass(d):
- #Split off fractional seconds, append 'Z'
- return d.isoformat().split(".")[0]+"Z"
-
- def getNow():
- return datetime.utcnow()
-
- def getHoursFromNow(hours):
- return datetime.utcnow() + timedelta(hours=hours)
-
- def getMinutesFromNow(minutes):
- return datetime.utcnow() + timedelta(minutes=minutes)
-
- def isDateClassExpired(d):
- return d < datetime.utcnow()
-
- def isDateClassBefore(d1, d2):
- return d1 < d2
-
-else:
- #Jython 2.1 is missing lots of python 2.3 stuff,
- #which we have to emulate here:
- import java
- import jarray
-
- def createDateClass(year, month, day, hour, minute, second):
- c = java.util.Calendar.getInstance()
- c.setTimeZone(java.util.TimeZone.getTimeZone("UTC"))
- c.set(year, month-1, day, hour, minute, second)
- return c
-
- def printDateClass(d):
- return "%04d-%02d-%02dT%02d:%02d:%02dZ" % \
- (d.get(d.YEAR), d.get(d.MONTH)+1, d.get(d.DATE), \
- d.get(d.HOUR_OF_DAY), d.get(d.MINUTE), d.get(d.SECOND))
-
- def getNow():
- c = java.util.Calendar.getInstance()
- c.setTimeZone(java.util.TimeZone.getTimeZone("UTC"))
- c.get(c.HOUR) #force refresh?
- return c
-
- def getHoursFromNow(hours):
- d = getNow()
- d.add(d.HOUR, hours)
- return d
-
- def isDateClassExpired(d):
- n = getNow()
- return d.before(n)
-
- def isDateClassBefore(d1, d2):
- return d1.before(d2)
« no previous file with comments | « third_party/tlslite/tlslite/utils/cryptlib_tripledes.py ('k') | third_party/tlslite/tlslite/utils/datefuncs.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698