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

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

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

Util.getPastTimeString介绍

[英]Get a human readable string representing strings like "xxx days ago", which should be used to point to the occurrence of an event in the past.
[中]获取一个人类可读的字符串,表示“xxx days ago”之类的字符串,该字符串应用于指向过去发生的事件。

代码示例

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

  1. /**
  2. * Gets the string that says how long since this build has scheduled.
  3. *
  4. * @return
  5. * string like "3 minutes" "1 day" etc.
  6. */
  7. public @Nonnull String getTimestampString() {
  8. long duration = System.currentTimeMillis()-timestamp.getTime();
  9. return Util.getPastTimeString(duration);
  10. }

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

  1. /**
  2. * Gets the string that says how long since this build has started.
  3. *
  4. * @return
  5. * string like "3 minutes" "1 day" etc.
  6. */
  7. public @Nonnull String getTimestampString() {
  8. long duration = new GregorianCalendar().getTimeInMillis()-timestamp;
  9. return Util.getPastTimeString(duration);
  10. }

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

  1. /**
  2. * Gets the string that says how long since this build has started.
  3. *
  4. * @return
  5. * string like "3 minutes" "1 day" etc.
  6. */
  7. public String getTimestampString() {
  8. return Util.getPastTimeString(getElapsedTime());
  9. }

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

  1. public String getTimestampString() {
  2. if (record==null)
  3. return Messages.AbstractNodeMonitorDescriptor_NoDataYet();
  4. // return Messages.AbstractNodeMonitorDescriptor_DataObtainedSometimeAgo(
  5. // Util.getTimeSpanString(System.currentTimeMillis()-record.timestamp));
  6. return Util.getPastTimeString(System.currentTimeMillis()-record.timestamp);
  7. }

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

  1. /**
  2. * Gets the string representing how long ago the data was obtained.
  3. * Will be the newest of all {@link UpdateSite}s.
  4. */
  5. public String getLastUpdatedString() {
  6. long newestTs = 0;
  7. for (UpdateSite s : sites) {
  8. if (s.getDataTimestamp()>newestTs) {
  9. newestTs = s.getDataTimestamp();
  10. }
  11. }
  12. if (newestTs == 0) {
  13. return Messages.UpdateCenter_n_a();
  14. }
  15. return Util.getPastTimeString(System.currentTimeMillis()-newestTs);
  16. }

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

  1. /**
  2. * Gets the string that says how long since this build has scheduled.
  3. *
  4. * @return string like "3 minutes" "1 day" etc.
  5. */
  6. public String getTimestampString() {
  7. long duration = System.currentTimeMillis() - timestamp.getTime();
  8. return Util.getPastTimeString(duration);
  9. }

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

  1. /**
  2. * Gets the string that says how long since this build has started.
  3. *
  4. * @return
  5. * string like "3 minutes" "1 day" etc.
  6. */
  7. public String getTimestampString() {
  8. long duration = new GregorianCalendar().getTimeInMillis()-timestamp;
  9. return Util.getPastTimeString(duration);
  10. }

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

  1. /**
  2. * Gets the string that says how long since this build has started.
  3. *
  4. * @return
  5. * string like "3 minutes" "1 day" etc.
  6. */
  7. public String getTimestampString() {
  8. long duration = new GregorianCalendar().getTimeInMillis()-timestamp;
  9. return Util.getPastTimeString(duration);
  10. }

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

  1. /**
  2. * Gets the string that says how long since this build has scheduled.
  3. *
  4. * @return
  5. * string like "3 minutes" "1 day" etc.
  6. */
  7. public String getTimestampString() {
  8. long duration = System.currentTimeMillis()-timestamp.getTime();
  9. return Util.getPastTimeString(duration);
  10. }

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

  1. /**
  2. * Gets the string that says how long since this build has scheduled.
  3. *
  4. * @return
  5. * string like "3 minutes" "1 day" etc.
  6. */
  7. public String getTimestampString() {
  8. long duration = System.currentTimeMillis()-timestamp.getTime();
  9. return Util.getPastTimeString(duration);
  10. }

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

  1. /**
  2. * Gets the string that says how long since this build has started.
  3. *
  4. * @return
  5. * string like "3 minutes" "1 day" etc.
  6. */
  7. public @Nonnull String getTimestampString() {
  8. long duration = new GregorianCalendar().getTimeInMillis()-timestamp;
  9. return Util.getPastTimeString(duration);
  10. }

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

  1. /**
  2. * Gets the string that says how long since this build has scheduled.
  3. *
  4. * @return
  5. * string like "3 minutes" "1 day" etc.
  6. */
  7. public @Nonnull String getTimestampString() {
  8. long duration = System.currentTimeMillis()-timestamp.getTime();
  9. return Util.getPastTimeString(duration);
  10. }

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

  1. /**
  2. * Gets the string that says how long since this build has started.
  3. *
  4. * @return string like "3 minutes" "1 day" etc.
  5. */
  6. public String getTimestampString() {
  7. return Util.getPastTimeString(getElapsedTime());
  8. }

代码示例来源:origin: org.jenkins-ci.plugins/cloudbees-folder

  1. /**
  2. * Gets the string that says how long since this build has started.
  3. *
  4. * @return string like "3 minutes" "1 day" etc.
  5. */
  6. @Nonnull
  7. public String getTimestampString() {
  8. long duration = new GregorianCalendar().getTimeInMillis() - computation.getTimestamp().getTimeInMillis();
  9. return Util.getPastTimeString(duration);
  10. }

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

  1. /**
  2. * Gets the string that says how long since this build has started.
  3. *
  4. * @return
  5. * string like "3 minutes" "1 day" etc.
  6. */
  7. public String getTimestampString() {
  8. return Util.getPastTimeString(getElapsedTime());
  9. }

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

  1. /**
  2. * Gets the string that says how long since this build has started.
  3. *
  4. * @return
  5. * string like "3 minutes" "1 day" etc.
  6. */
  7. public String getTimestampString() {
  8. return Util.getPastTimeString(getElapsedTime());
  9. }

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

  1. /**
  2. * Gets the string that says how long since this build has started.
  3. *
  4. * @return
  5. * string like "3 minutes" "1 day" etc.
  6. */
  7. public String getTimestampString() {
  8. return Util.getPastTimeString(getElapsedTime());
  9. }

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

  1. public String getTimestampString() {
  2. if (record==null)
  3. return Messages.AbstractNodeMonitorDescriptor_NoDataYet();
  4. // return Messages.AbstractNodeMonitorDescriptor_DataObtainedSometimeAgo(
  5. // Util.getTimeSpanString(System.currentTimeMillis()-record.timestamp));
  6. return Util.getPastTimeString(System.currentTimeMillis()-record.timestamp);
  7. }

代码示例来源:origin: jenkinsci/cloudbees-folder-plugin

  1. /**
  2. * Gets the string that says how long since this build has started.
  3. *
  4. * @return string like "3 minutes" "1 day" etc.
  5. */
  6. @Nonnull
  7. public String getTimestampString() {
  8. long duration = new GregorianCalendar().getTimeInMillis() - computation.getTimestamp().getTimeInMillis();
  9. return Util.getPastTimeString(duration);
  10. }

代码示例来源:origin: jenkinsci/docker-plugin

  1. /** How long ago this was disabled by the system, e.g. "3 min 0 sec". */
  2. public String getWhenDisabledBySystemString() {
  3. if (!getDisabledBySystem()) {
  4. return "";
  5. }
  6. final long now = readTimeNowInNanoseconds();
  7. final long howLongAgoInNanoseconds = now - nanotimeWhenDisabledBySystem;
  8. final long howLongAgoInMilliseconds = TimeUnit.NANOSECONDS.toMillis(howLongAgoInNanoseconds);
  9. return Util.getPastTimeString(howLongAgoInMilliseconds);
  10. }

相关文章