mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
d7db6c3148
mktime function uses tm_isdst member as an indicator whether the time stamp is expected to be in daylight saving time (1) or not (0). FAT filesystem uses local time as mtime, so no information about DST is available from the filesystem. According to mktime documentation, tm_isdst can be set to -1, in which case the C library will try to determine if DST was or wasn't in effect at that time, and will set UTC time accordingly. Note that the conversion from UTC to local time and then back to UTC (time_t -> localtime_r -> FAT timestamp -> mktime -> time_t) does not always recover the same UTC time. In particular, the local time in the hour before DST comes into effect can be interpreted as "before DST" or "after DST", which would correspond to different UTC values. In this case which option the C library chooses is undefined. Closes https://github.com/espressif/esp-idf/issues/9039 Originally reported in https://github.com/espressif/arduino-esp32/issues/6786
75 lines
2.4 KiB
C
75 lines
2.4 KiB
C
// Copyright 2015-2017 Espressif Systems (Shanghai) PTE LTD
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
#pragma once
|
|
|
|
/**
|
|
* @file test_fatfs_common.h
|
|
* @brief Common routines for FAT-on-SDMMC and FAT-on-WL tests
|
|
*/
|
|
|
|
#define HEAP_SIZE_CAPTURE(heap_size) \
|
|
heap_size = esp_get_free_heap_size();
|
|
|
|
#define HEAP_SIZE_CHECK(heap_size, tolerance) \
|
|
do {\
|
|
size_t final_heap_size = esp_get_free_heap_size(); \
|
|
if (final_heap_size < heap_size - tolerance) { \
|
|
printf("Initial heap size: %d, final: %d, diff=%d\n", heap_size, final_heap_size, heap_size - final_heap_size); \
|
|
} \
|
|
} while(0)
|
|
|
|
const char* fatfs_test_hello_str;
|
|
const char* fatfs_test_hello_str_utf;
|
|
|
|
void test_fatfs_create_file_with_text(const char* name, const char* text);
|
|
|
|
void test_fatfs_overwrite_append(const char* filename);
|
|
|
|
void test_fatfs_read_file(const char* filename);
|
|
|
|
void test_fatfs_read_file_utf_8(const char* filename);
|
|
|
|
void test_fatfs_pread_file(const char* filename);
|
|
|
|
void test_fatfs_pwrite_file(const char* filename);
|
|
|
|
void test_fatfs_open_max_files(const char* filename_prefix, size_t files_count);
|
|
|
|
void test_fatfs_lseek(const char* filename);
|
|
|
|
void test_fatfs_truncate_file(const char* path);
|
|
|
|
void test_fatfs_stat(const char* filename, const char* root_dir);
|
|
|
|
void test_fatfs_mtime_dst(const char* filename, const char* root_dir);
|
|
|
|
void test_fatfs_utime(const char* filename, const char* root_dir);
|
|
|
|
void test_fatfs_unlink(const char* filename);
|
|
|
|
void test_fatfs_link_rename(const char* filename_prefix);
|
|
|
|
void test_fatfs_concurrent(const char* filename_prefix);
|
|
|
|
void test_fatfs_mkdir_rmdir(const char* filename_prefix);
|
|
|
|
void test_fatfs_can_opendir(const char* path);
|
|
|
|
void test_fatfs_opendir_readdir_rewinddir(const char* dir_prefix);
|
|
|
|
void test_fatfs_opendir_readdir_rewinddir_utf_8(const char* dir_prefix);
|
|
|
|
void test_fatfs_rw_speed(const char* filename, void* buf, size_t buf_size, size_t file_size, bool write);
|