Time components : precision in ms

Hello !
I use Time component with platform homeassistant to synchronize my esp clock like that

time:
  - platform: homeassistant
    id: homeassistant_time

I would like to use it with a precision of 0.1s or 0.05s. Can i do that ? How can i retrieve something like millis() arduino function ?

Here is the code i use in lambda

        lambda: |-
          ESP_LOGD("main", "Time %d", millis());
          ESP_LOGD("main", "Time %d", id(homeassistant_time).now());  

Thank you very much for your help.

I reply the solution i’ve found.
Normaly, you can get a precision of few millisecond, that’s a lot enough for me :slight_smile:
To retrive millis, i’ve used gettimeofday() function. I’ve test with two nodemcu and they are synchronised, i’m happy !
Here is my lambda code…

        lambda: |-
          ESP_LOGD("main", "Millis() %d", millis());
          ESP_LOGD("main", "now() %d", id(homeassistant_time).now());
          struct timeval tv;
          gettimeofday(&tv, NULL);
          ESP_LOGD("main", "tv_sec %ld", tv.tv_sec);
          ESP_LOGD("main", "tv_usec %d", tv.tv_usec);