hudson.Util.makeTimeSpanString()方法的使用及代码示例

x33g5p2x  于2022-01-31 转载在 其他  
字(4.7k)|赞(0)|评价(0)|浏览(129)

本文整理了Java中hudson.Util.makeTimeSpanString()方法的一些代码示例,展示了Util.makeTimeSpanString()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.makeTimeSpanString()方法的具体详情如下:
包路径:hudson.Util
类名称:Util
方法名:makeTimeSpanString

Util.makeTimeSpanString介绍

[英]Create a string representation of a time duration. If the quantity of the most significant unit is big (>=10), then we use only that most significant unit in the string representation. If the quantity of the most significant unit is small (a single-digit value), then we also use a secondary, smaller unit for increased precision. So 13 minutes and 43 seconds returns just "13 minutes", but 3 minutes and 43 seconds is "3 minutes 43 seconds".
[中]创建持续时间的字符串表示形式。如果最高有效单位的数量很大(>=10),那么我们在字符串表示中只使用最高有效单位。如果最高有效单位的数量很小(一个位数的值),那么我们也使用次要的、较小的单位来提高精度。所以13分43秒只返回“13分钟”,但3分43秒是“3分43秒”。

代码示例

代码示例来源:origin: jenkinsci/jenkins

return makeTimeSpanString(years, Messages.Util_year(years), months, Messages.Util_month(months));
else if (months > 0)
  return makeTimeSpanString(months, Messages.Util_month(months), days, Messages.Util_day(days));
else if (days > 0)
  return makeTimeSpanString(days, Messages.Util_day(days), hours, Messages.Util_hour(hours));
else if (hours > 0)
  return makeTimeSpanString(hours, Messages.Util_hour(hours), minutes, Messages.Util_minute(minutes));
else if (minutes > 0)
  return makeTimeSpanString(minutes, Messages.Util_minute(minutes), seconds, Messages.Util_second(seconds));
else if (seconds >= 10)
  return Messages.Util_second(seconds);

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

return makeTimeSpanString(years, Messages.Util_year(years), months, Messages.Util_month(months));
else if (months > 0)
  return makeTimeSpanString(months, Messages.Util_month(months), days, Messages.Util_day(days));
else if (days > 0)
  return makeTimeSpanString(days, Messages.Util_day(days), hours, Messages.Util_hour(hours));
else if (hours > 0)
  return makeTimeSpanString(hours, Messages.Util_hour(hours), minutes, Messages.Util_minute(minutes));
else if (minutes > 0)
  return makeTimeSpanString(minutes, Messages.Util_minute(minutes), seconds, Messages.Util_second(seconds));
else if (seconds >= 10)
  return Messages.Util_second(seconds);

代码示例来源:origin: hudson/hudson-2.x

return makeTimeSpanString(years, Messages.Util_year(years), months, Messages.Util_month(months));
else if (months > 0)
  return makeTimeSpanString(months, Messages.Util_month(months), days, Messages.Util_day(days));
else if (days > 0)
  return makeTimeSpanString(days, Messages.Util_day(days), hours, Messages.Util_hour(hours));
else if (hours > 0)
  return makeTimeSpanString(hours, Messages.Util_hour(hours), minutes, Messages.Util_minute(minutes));
else if (minutes > 0)
  return makeTimeSpanString(minutes, Messages.Util_minute(minutes), seconds, Messages.Util_second(seconds));
else if (seconds >= 10)
  return Messages.Util_second(seconds);

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

return makeTimeSpanString(years, Messages.Util_year(years), months, Messages.Util_month(months));
else if (months > 0)
  return makeTimeSpanString(months, Messages.Util_month(months), days, Messages.Util_day(days));
else if (days > 0)
  return makeTimeSpanString(days, Messages.Util_day(days), hours, Messages.Util_hour(hours));
else if (hours > 0)
  return makeTimeSpanString(hours, Messages.Util_hour(hours), minutes, Messages.Util_minute(minutes));
else if (minutes > 0)
  return makeTimeSpanString(minutes, Messages.Util_minute(minutes), seconds, Messages.Util_second(seconds));
else if (seconds >= 10)
  return Messages.Util_second(seconds);

代码示例来源:origin: org.eclipse.hudson/hudson-core

return makeTimeSpanString(years, Messages.Util_year(years), months, Messages.Util_month(months));
} else if (months > 0) {
  return makeTimeSpanString(months, Messages.Util_month(months), days, Messages.Util_day(days));
} else if (days > 0) {
  return makeTimeSpanString(days, Messages.Util_day(days), hours, Messages.Util_hour(hours));
} else if (hours > 0) {
  return makeTimeSpanString(hours, Messages.Util_hour(hours), minutes, Messages.Util_minute(minutes));
} else if (minutes > 0) {
  return makeTimeSpanString(minutes, Messages.Util_minute(minutes), seconds, Messages.Util_second(seconds));
} else if (seconds >= 10) {
  return Messages.Util_second(seconds);

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

return makeTimeSpanString(years, Messages.Util_year(years), months, Messages.Util_month(months));
} else if (months > 0) {
  return makeTimeSpanString(months, Messages.Util_month(months), days, Messages.Util_day(days));
} else if (days > 0) {
  return makeTimeSpanString(days, Messages.Util_day(days), hours, Messages.Util_hour(hours));
} else if (hours > 0) {
  return makeTimeSpanString(hours, Messages.Util_hour(hours), minutes, Messages.Util_minute(minutes));
} else if (minutes > 0) {
  return makeTimeSpanString(minutes, Messages.Util_minute(minutes), seconds, Messages.Util_second(seconds));
} else if (seconds >= 10) {
  return Messages.Util_second(seconds);

相关文章

微信公众号

最新文章

更多