当前位置: 首页>>代码示例>>Python>>正文


Python Time.timetopretty方法代码示例

本文整理汇总了Python中Time.timetopretty方法的典型用法代码示例。如果您正苦于以下问题:Python Time.timetopretty方法的具体用法?Python Time.timetopretty怎么用?Python Time.timetopretty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Time的用法示例。


在下文中一共展示了Time.timetopretty方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_timestats_string

# 需要导入模块: import Time [as 别名]
# 或者: from Time import timetopretty [as 别名]
 def get_timestats_string(self):
     """Return portion of statistics string dealing with time"""
     timelist = []
     if self.StartTime is not None:
         timelist.append("StartTime %.2f (%s)\n" % (self.StartTime, Time.timetopretty(self.StartTime)))
     if self.EndTime is not None:
         timelist.append("EndTime %.2f (%s)\n" % (self.EndTime, Time.timetopretty(self.EndTime)))
     if self.ElapsedTime or (self.StartTime is not None and self.EndTime is not None):
         if self.ElapsedTime is None:
             self.ElapsedTime = self.EndTime - self.StartTime
         timelist.append("ElapsedTime %.2f (%s)\n" % (self.ElapsedTime, Time.inttopretty(self.ElapsedTime)))
     return "".join(timelist)
开发者ID:Christoph-D,项目名称:rdiff-backup,代码行数:14,代码来源:statistics.py

示例2: triple_to_line

# 需要导入模块: import Time [as 别名]
# 或者: from Time import timetopretty [as 别名]
	def triple_to_line(triple):
		"""Convert triple to display string"""
		time, size, cum_size = triple
		return "%24s   %13s   %15s" % \
			   (Time.timetopretty(time),
				stat_obj.get_byte_summary_string(size),
				stat_obj.get_byte_summary_string(cum_size))
开发者ID:Christoph-D,项目名称:rdiff-backup,代码行数:9,代码来源:manage.py

示例3: yield_metadata

# 需要导入模块: import Time [as 别名]
# 或者: from Time import timetopretty [as 别名]
def yield_metadata():
	"""Iterate rorps from metadata file, if any are available"""
	metadata.SetManager()
	metadata_iter = metadata.ManagerObj.GetAtTime(regress_time)
	if metadata_iter: return metadata_iter
	log.Log.FatalError("No metadata for time %s (%s) found,\ncannot regress"
					   % (Time.timetopretty(regress_time), regress_time))
开发者ID:Christoph-D,项目名称:rdiff-backup,代码行数:9,代码来源:regress.py

示例4: describe_incs_human

# 需要导入模块: import Time [as 别名]
# 或者: from Time import timetopretty [as 别名]
def describe_incs_human(incs, mirror_time, mirrorrp):
	"""Return a string describing all the the root increments"""
	incpairs = [(inc.getinctime(), inc) for inc in incs]
	incpairs.sort()

	result = ["Found %d increments:" % len(incpairs)]
	if Globals.chars_to_quote:
		for time, inc in incpairs:
			result.append("    %s   %s" %
						  (FilenameMapping.unquote(inc.dirsplit()[1]),
						   Time.timetopretty(time)))
	else:
		for time, inc in incpairs:
			result.append("    %s   %s" %
						  (inc.dirsplit()[1], Time.timetopretty(time)))
	result.append("Current mirror: %s" % Time.timetopretty(mirror_time))
	return "\n".join(result)
开发者ID:Christoph-D,项目名称:rdiff-backup,代码行数:19,代码来源:manage.py

示例5: set_regress_time

# 需要导入模块: import Time [as 别名]
# 或者: from Time import timetopretty [as 别名]
def set_regress_time():
	"""Set global regress_time to previous sucessful backup

	If there are two current_mirror increments, then the last one
	corresponds to a backup session that failed.

	"""
	global regress_time, unsuccessful_backup_time
	manager = metadata.SetManager()
	curmir_incs = manager.sorted_prefix_inclist('current_mirror')
	assert len(curmir_incs) == 2, \
		   "Found %s current_mirror flags, expected 2" % len(curmir_incs)
	mirror_rp_to_delete = curmir_incs[0]
	regress_time = curmir_incs[1].getinctime()
	unsuccessful_backup_time = mirror_rp_to_delete.getinctime()
	log.Log("Regressing to " + Time.timetopretty(regress_time), 4)
	return manager, mirror_rp_to_delete
开发者ID:Christoph-D,项目名称:rdiff-backup,代码行数:19,代码来源:regress.py

示例6: rot_check_time

# 需要导入模块: import Time [as 别名]
# 或者: from Time import timetopretty [as 别名]
def rot_check_time(time_string):
	"""Check remove older than time_string, return time in seconds"""
	try: time = Time.genstrtotime(time_string)
	except Time.TimeException, exc: Log.FatalError(str(exc))

	times_in_secs = [inc.getinctime() for inc in 
		  restore.get_inclist(Globals.rbdir.append_path("increments"))]
	times_in_secs = filter(lambda t: t < time, times_in_secs)
	if not times_in_secs:
		Log("No increments older than %s found, exiting." %
			(Time.timetopretty(time),), 3)
		return None

	times_in_secs.sort()
	inc_pretty_time = "\n".join(map(Time.timetopretty, times_in_secs))
	if len(times_in_secs) > 1 and not force:
		Log.FatalError("Found %d relevant increments, dated:\n%s"
			"\nIf you want to delete multiple increments in this way, "
			"use the --force." % (len(times_in_secs), inc_pretty_time))
	if len(times_in_secs) == 1:
		Log("Deleting increment at time:\n" + inc_pretty_time, 3)
	else: Log("Deleting increments at times:\n" + inc_pretty_time, 3)
	return times_in_secs[-1]+1 # make sure we don't delete current increment
开发者ID:blackcoffeerider,项目名称:rdiff-backup,代码行数:25,代码来源:Main.py

示例7: map

# 需要导入模块: import Time [as 别名]
# 或者: from Time import timetopretty [as 别名]
	select_data = map(fp2string, select_files)
	if select_opts: 
		mirror_rp.conn.restore.MirrorStruct.set_mirror_select(
			target, select_opts, *map(cStringIO.StringIO, select_data))
		target.conn.restore.TargetStruct.set_target_select(
			target, select_opts, *map(cStringIO.StringIO, select_data))

def restore_start_log(rpin, target, time):
	"""Open restore log file, log initial message"""
	try: Log.open_logfile(Globals.rbdir.append("restore.log"))
	except (LoggerError, Security.Violation), e:
		Log("Warning - Unable to open logfile: " + str(e), 2)

	# Log following message at file verbosity 3, but term verbosity 4
	log_message = ("Starting restore of %s to %s as it was as of %s." %
				   (rpin.path, target.path, Time.timetopretty(time)))
	if Log.term_verbosity >= 4: Log.log_to_term(log_message, 4)
	if Log.verbosity >= 3: Log.log_to_file(log_message)

def restore_check_paths(rpin, rpout, restoreasof = None):
	"""Make sure source and destination exist, and have appropriate type"""
	if not restoreasof:
		if not rpin.lstat():
			Log.FatalError("Source file %s does not exist" % rpin.path)
	if not force and rpout.lstat() and (not rpout.isdir() or rpout.listdir()):
		Log.FatalError("Restore target %s already exists, "
					   "specify --force to overwrite." % rpout.path)
	if force and rpout.lstat() and not rpout.isdir(): rpout.delete()

def restore_check_backup_dir(mirror_root, src_rp = None, restore_as_of = 1):
	"""Make sure backup dir root rpin is in consistent state"""
开发者ID:blackcoffeerider,项目名称:rdiff-backup,代码行数:33,代码来源:Main.py

示例8: pretty_time

# 需要导入模块: import Time [as 别名]
# 或者: from Time import timetopretty [as 别名]
	def pretty_time(self):
		"""Return a formatted version of inc's time"""
		return Time.timetopretty(self.time)
开发者ID:Christoph-D,项目名称:rdiff-backup,代码行数:5,代码来源:manage.py


注:本文中的Time.timetopretty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。