mirror of
https://github.com/neovim/neovim.git
synced 2025-10-03 08:28:34 +00:00
vim-patch:8.1.2326: cannot parse a date/time string
Problem: Cannot parse a date/time string. Solution: Add strptime(). (Stephen Wall, closes #)10455d43fe
N/A patches for version.c: vim-patch:8.1.2344: Cygwin: warning for using strptime() Problem: Cygwin: warning for using strptime(). Solution: Move defining _XOPEN_SOURCE and __USE_XOPEN to vim.h. (Ken Takata, closes vim/vim#5265) Use 700 for _XOPEN_SOURCE for mkdtemp().6a228c6463
This commit is contained in:
@@ -196,6 +196,22 @@ char *os_ctime(char *result, size_t result_len)
|
||||
return os_ctime_r(&rawtime, result, result_len);
|
||||
}
|
||||
|
||||
/// Portable version of POSIX strptime()
|
||||
///
|
||||
/// @param str[in] string to convert
|
||||
/// @param format[in] format to parse "str"
|
||||
/// @param tm[out] time representation of "str"
|
||||
/// @return Pointer to first unprocessed character or NULL
|
||||
char *os_strptime(const char *str, const char *format, struct tm *tm)
|
||||
FUNC_ATTR_NONNULL_ALL
|
||||
{
|
||||
#ifdef HAVE_STRPTIME
|
||||
return strptime(str, format, tm);
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
/// Obtains the current Unix timestamp.
|
||||
///
|
||||
/// @return Seconds since epoch.
|
||||
|
Reference in New Issue
Block a user