Tasks #1273

Change rst.timing.Timestamp.time to seconds

Added by J. Moringen over 11 years ago. Updated over 11 years ago.

Status:RejectedStart date:11/29/2012
Priority:NormalDue date:
Assignee:J. Moringen% Done:

80%

Category:-
Target version:Robotics Service Bus - rsb-0.9

Description

  • change unit to seconds
  • change type to double

Related issues

Related to Robotics Systems Types - Tasks #1271: Change rst.timing.Duration.time to seconds Rejected 11/29/2012

History

#1 Updated by A. Swadzba over 11 years ago

Um das zu tun, müsste ich mir den rst-0.8 branch auschecken, oder?

#2 Updated by J. Moringen over 11 years ago

This issue is intended to collect opinions. The actual change, if any, can be done later.

#3 Updated by A. Swadzba over 11 years ago

In principal possible, but would effect existing source code.

#4 Updated by J. Moringen over 11 years ago

Other opinions?

I brought this up because we mostly use SI units.

#5 Updated by J. Moringen over 11 years ago

  • Assignee changed from A. Swadzba to J. Moringen
  • % Done changed from 0 to 80

We discussed this and it seems better to keep the current definition. Sorry.

There were four major arguments:

SI Units

In favor of change: We try to use SI units without magnitude prefixes, wherever possible.

Precision

Inconclusive: Experiments show that, in general, uint64 and double-float, but not single-float, provide enough precision for accurate timestamp calculation:

CL-USER> (let* ((now    (local-time:now))
                (a/sec  (local-time:timestamp-to-unix now))
                (a/nsec (local-time:nsec-of now))

                (ai     (+ (* 1000000 a/sec) (floor a/nsec 1000)))
                (af     (float ai 1.0f0)) ; single float
                (ad     (float ai 1.0d0)) ; double float

                (bi     (+ (* 1000000 0) (+ (floor a/nsec 1000) 1)))
                (bf     (float bi 1.0f0)) ; single float
                (bd     (float bi 1.0d0)) ; double float
                )
           (format t "Integer   ~20D   - ~20D   = ~20D~%Single Float~20F -   ~20F =   ~20F~%Double Float~20F -   ~20F =   ~20F~%" 
                   bi ai (- ai bi) 
                   bf af (- af bf)
                   bd ad (- ad bd)))
Integer                 166762   -     1354300814166761   =     1354300813999999
Single Float            166762.0 -     1354300800000000.0 =     1354300800000000.0
Double Float            166762.0 -     1354300814166761.0 =     1354300813999999.0

Efficiency

Against change: In most cases, manipulation of integers is more efficient than manipulation of floats.

Common Practice

Against change: It was our impression that in most related work, timestamps are represented as integer/msec or integer/µsec.

Conclusion

We came to the conclusion that it would be best to keep the uint64/µsec representation and convert to float/sec in clients who want this (maybe with support from Rosetta Stone Project).

If nobody objects, I would add this explanation/rationale to the documentation strings of the data type and reject the issue.

#6 Updated by J. Moringen over 11 years ago

  • Status changed from Feedback to Rejected

Also available in: Atom PDF