mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-08-06 15:15:15 +08:00
Merge branch 'feature/modify_log_time_unit' into 'master'
Modify log time unit from "s" to "ms" See merge request sdk/ESP8266_RTOS_SDK!367
This commit is contained in:
@ -49,6 +49,11 @@ static const char s_log_prefix[ESP_LOG_MAX] = {
|
|||||||
'V', // ESP_LOG_VERBOSE
|
'V', // ESP_LOG_VERBOSE
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static uint32_t IRAM_ATTR esp_log_early_timestamp()
|
||||||
|
{
|
||||||
|
return xthal_get_ccount() / (80 * 1000);
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef BOOTLOADER_BUILD
|
#ifndef BOOTLOADER_BUILD
|
||||||
static _lock_t s_lock;
|
static _lock_t s_lock;
|
||||||
static putchar_like_t s_putchar_func = &putchar;
|
static putchar_like_t s_putchar_func = &putchar;
|
||||||
@ -66,19 +71,10 @@ static int esp_log_write_str(const char *s)
|
|||||||
|
|
||||||
static uint32_t esp_log_timestamp()
|
static uint32_t esp_log_timestamp()
|
||||||
{
|
{
|
||||||
time_t t;
|
return clock() * (1000 / CLOCKS_PER_SEC) + esp_log_early_timestamp() % (1000 / CLOCKS_PER_SEC);
|
||||||
|
|
||||||
t = time(NULL);
|
|
||||||
|
|
||||||
return t;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static uint32_t IRAM_ATTR esp_log_early_timestamp()
|
|
||||||
{
|
|
||||||
return xthal_get_ccount() / (80 * 1000);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Write message into the log at system startup or critical state
|
* @brief Write message into the log at system startup or critical state
|
||||||
*/
|
*/
|
||||||
|
1
components/newlib/Makefile.projbuild
Normal file
1
components/newlib/Makefile.projbuild
Normal file
@ -0,0 +1 @@
|
|||||||
|
CFLAGS += -D_CLOCKS_PER_SEC_=CONFIG_FREERTOS_HZ
|
@ -14,12 +14,14 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <reent.h>
|
#include <reent.h>
|
||||||
|
#include <sys/times.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
|
||||||
#include "esp_system.h"
|
#include "esp_system.h"
|
||||||
#include "esp_timer.h"
|
#include "esp_timer.h"
|
||||||
|
|
||||||
#include "FreeRTOS.h"
|
#include "FreeRTOS.h"
|
||||||
|
#include "task.h"
|
||||||
|
|
||||||
extern uint32_t esp_get_time();
|
extern uint32_t esp_get_time();
|
||||||
|
|
||||||
@ -129,3 +131,13 @@ int settimeofday(const struct timeval* tv, const struct timezone* tz)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clock_t _times_r(struct _reent *r, struct tms *tms)
|
||||||
|
{
|
||||||
|
tms->tms_utime = xTaskGetTickCount();
|
||||||
|
tms->tms_stime = 0;
|
||||||
|
tms->tms_cutime = 0;
|
||||||
|
tms->tms_cstime = 0;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user