Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve file timestamp resolution #1882

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mgomez12
Copy link

@mgomez12 mgomez12 commented Jan 29, 2025

Currently, file timestamps returned by the SMBServer are obtained by unpacking the 10-tuple returned by os.stat(some_path). However, accessing the timestamp fields in that manner returns an integer Unix timestamp, providing 1-second resolution.

This PR changes such occurences to use named access instead (using the field st_{a/c/m}time ), which returns a float value with improved resolution.

Testing with one of my projects that uses the SMB client's listPath method:

Before

>>> c.retrieve_latest_file()
2025-01-29 09:43:25.717 | INFO     | controller:retrieve_file:39 - Retrieving latest file
2025-01-29 09:43:26.750 | INFO     | driver:retrieve_file:47 - Found new result file test.csv created at 133826174050000000

After

>>> c.retrieve_latest_file()
2025-01-29 09:44:53.474 | INFO     | controller:retrieve_file:39 - Retrieving latest file
2025-01-29 09:44:54.516 | DEBUG    | driver:retrieve_file:47 - Found new result file test.csv created at 133826174934897888

@zamlz
Copy link

zamlz commented Jan 29, 2025

I'd love these changes as well!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants