• Icon: New Feature New Feature
    • Resolution: Fixed
    • Icon: Major Major
    • timestamper-plugin
    • None

      Please provide a way to retrieve the current Jenkins time, ideally in the same format as the job start timestamp.

      System time on client machines calling the api will invariably be out of synch with the Jenkins server time, so it would be very helpful to have a way to understand exactly what time the Jenkins server thinks it is.

      Also, the api call for timestamps or time elapsed returns a lot of data; I'm only interested in the last line of that data, so I would like to be able to retrieve just a single value representing the current time at the moment of an api call.

      As a bonus, it would be nice to also have access to a single value representing total time elapsed since job start.

          [JENKINS-21687] Add api call for current jenkins time

          Code changed in jenkins
          User: Steven Brown
          Path:
          src/main/java/hudson/plugins/timestamper/action/TimestampsActionOutput.java
          src/main/java/hudson/plugins/timestamper/action/TimestampsActionQuery.java
          src/test/java/hudson/plugins/timestamper/action/TimestampsActionOutputTest.java
          src/test/java/hudson/plugins/timestamper/action/TimestampsActionQueryTest.java
          http://jenkins-ci.org/commit/timestamper-plugin/820a9adbe0eb54d9c48aa850c6b75a5bb8bfdceb
          Log:
          JENKINS-21687: Add ability to retrieve the current time from the /timestamps URL

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Steven Brown Path: src/main/java/hudson/plugins/timestamper/action/TimestampsActionOutput.java src/main/java/hudson/plugins/timestamper/action/TimestampsActionQuery.java src/test/java/hudson/plugins/timestamper/action/TimestampsActionOutputTest.java src/test/java/hudson/plugins/timestamper/action/TimestampsActionQueryTest.java http://jenkins-ci.org/commit/timestamper-plugin/820a9adbe0eb54d9c48aa850c6b75a5bb8bfdceb Log: JENKINS-21687 : Add ability to retrieve the current time from the /timestamps URL

          Examples:

          • Retrieve the current Jenkins time (since Timestamper 1.8.8)
            /timestamps?currentTime&time=HH:mm:ss
          • Retrieve the last line of the timestamps data (since Timestamper 1.8)
            /timestamps?time=HH:mm:ss&appendLog&startLine=-1
          • Retrieve the total time elapsed since job start (since Timestamper 1.8.8)
            /timestamps?currentTime&elapsed=HH:mm:ss.S

          Steven G Brown added a comment - Examples: Retrieve the current Jenkins time (since Timestamper 1.8.8) /timestamps?currentTime&time=HH:mm:ss Retrieve the last line of the timestamps data (since Timestamper 1.8) /timestamps?time=HH:mm:ss&appendLog&startLine=-1 Retrieve the total time elapsed since job start (since Timestamper 1.8.8) /timestamps?currentTime&elapsed=HH:mm:ss.S

            stevengbrown Steven G Brown
            ellemenno Peter Gerstmann
            Votes:
            3 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: