MartijnBraam / python-isc-dhcp-leases

Small python module for reading /var/lib/dhcp/dhcpd.leases from isc-dhcp-server
MIT License
123 stars 47 forks source link

Add cltt, atsfp, tsfp and tstp as date formatted properties #31

Open jjakob opened 5 years ago

jjakob commented 5 years ago

There is a way to get these from data{} but unformatted, as-is in leases file. start and end get formatted with parse_time so these four should be also. Otherwise we'd need to duplicate the parse_time in our script.

MartijnBraam commented 5 years ago

That sounds like a good improvement. I'll look into it

jjakob commented 5 years ago

Also worth documenting that the times are in UTC regardless of the system timezone and the datatime objects are naive (have no timezone data). It would maybe be useful to make these aware.

It wouldn't simplify things much as to conversion to local time but might be more correct.

https://github.com/vyos/vyos-1x/blob/9ff4f0c9f7cc75168b116de3a7d7adecbcc3bde1/src/op_mode/show_dhcpv6.py#L71

https://github.com/vyos/vyos-1x/blob/9ff4f0c9f7cc75168b116de3a7d7adecbcc3bde1/src/op_mode/show_dhcpv6.py#L64