aboutsummaryrefslogtreecommitdiffstats
path: root/util/datetime
diff options
context:
space:
mode:
authorsomov <somov@yandex-team.com>2024-01-31 21:31:25 +0300
committersomov <somov@yandex-team.com>2024-01-31 22:18:27 +0300
commit08217afa691874f76c2cd3ff0c386dad2c3252f7 (patch)
tree00c737e11522bf62e7094fc8bf59ea6abe94f95f /util/datetime
parent97ac585d7395d880e632f86d78b6ae333b6349e0 (diff)
downloadydb-08217afa691874f76c2cd3ff0c386dad2c3252f7.tar.gz
Fix sprintf deprecation warnings on newer macOS SDK
Diffstat (limited to 'util/datetime')
-rw-r--r--util/datetime/base.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/util/datetime/base.cpp b/util/datetime/base.cpp
index 9b4ec5234b..83a17660fd 100644
--- a/util/datetime/base.cpp
+++ b/util/datetime/base.cpp
@@ -258,7 +258,7 @@ void sprint_gm_date(char* buf, time_t when, long* sec) {
void DateToString(char* buf, const struct tm& theTm) {
Y_ENSURE(0 <= theTm.tm_year + 1900 && theTm.tm_year + 1900 <= 9999, "invalid year " + ToString(theTm.tm_year + 1900) + ", year should be in range [0, 9999]");
- sprintf(buf, "%04d%02d%02d", theTm.tm_year + 1900, theTm.tm_mon + 1, theTm.tm_mday);
+ snprintf(buf, DATE_BUF_LEN, "%04d%02d%02d", theTm.tm_year + 1900, theTm.tm_mon + 1, theTm.tm_mday);
}
void DateToString(char* buf, time_t when, long* sec) {
@@ -287,7 +287,7 @@ TString DateToString(time_t when, long* sec) {
TString YearToString(const struct tm& theTm) {
Y_ENSURE(0 <= theTm.tm_year + 1900 && theTm.tm_year + 1900 <= 9999, "invalid year " + ToString(theTm.tm_year + 1900) + ", year should be in range [0, 9999]");
char buf[16];
- sprintf(buf, "%04d", theTm.tm_year + 1900);
+ snprintf(buf, 16, "%04d", theTm.tm_year + 1900);
return buf;
}