/mandos/trunk

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/trunk

« back to all changes in this revision

Viewing changes to mandos-ctl

  • Committer: Teddy Hogeborn
  • Date: 2014-07-25 23:39:49 UTC
  • mto: This revision was merged to the branch mainline in revision 724.
  • Revision ID: teddy@recompile.se-20140725233949-rcg0bbj7q3uweh6p
Use the new .total_seconds() method on datetime.timedelta objects.

* mandos (timedelta_to_milliseconds): Removed.  All callers changed to
                                      use ".total_seconds() * 1000".
  (Client.timeout_milliseconds): - '' -
  (Client.extended_timeout_milliseconds): - '' -
  (Client.interval_milliseconds): - '' -
  (Client.approval_delay_milliseconds): - '' -
* mandos-ctl (timedelta_to_milliseconds): - '' -

Show diffs side-by-side

added added

removed removed

Lines of Context:
74
74
client_interface = domain + ".Mandos.Client"
75
75
version = "1.6.7"
76
76
 
77
 
def timedelta_to_milliseconds(td):
78
 
    """Convert a datetime.timedelta object to milliseconds"""
79
 
    return ((td.days * 24 * 60 * 60 * 1000)
80
 
            + (td.seconds * 1000)
81
 
            + (td.microseconds // 1000))
82
 
 
83
77
def milliseconds_to_string(ms):
84
78
    td = datetime.timedelta(0, 0, 0, ms)
85
79
    return ("{days}{hours:02}:{minutes:02}:{seconds:02}"
411
405
                """Set a Client D-Bus property, converted
412
406
                from a string to milliseconds."""
413
407
                set_client_prop(prop,
414
 
                                timedelta_to_milliseconds
415
 
                                (string_to_delta(value)))
 
408
                                string_to_delta(value).total_seconds()
 
409
                                * 1000)
416
410
            if options.remove:
417
411
                mandos_serv.RemoveClient(client.__dbus_object_path__)
418
412
            if options.enable: