time for Nim
the only difference with Python's is where some types in time is str, there is string in n_time's.
e.g. n_time.ctime() returns a string
py diff
Currently, tm_name is either "LOCAL" or "Etc/UTC", due to std/times only returning those two.
Warning:
A few of the format directives for strftime/strptime are not supported, and using them causes AssertDefect. They are listed in nstrfptime.NotImplDirectives
Consts
DefaultTimeFormat = "%a %b %d %H:%M:%S %Y"
- Source Edit
Procs
func asctime(t: struct_time): string {....raises: [], tags: [], forbids: [].}
- Source Edit
func asctime(tup: struct_time_tuple): typeof(asctime do: bind struct_time struct_time(tm_year: 1900, tm_mon: 1, tm_mday: 1, tm_yday: 1, tm_isdst: -1)) {. ...raises: [], tags: [], forbids: [].}
- Source Edit
func asctime(tup: struct_time_tuple10): typeof(asctime do: bind struct_time struct_time(tm_year: 1900, tm_mon: 1, tm_mday: 1, tm_yday: 1, tm_isdst: -1)) {. ...raises: [], tags: [], forbids: [].}
- Source Edit
func asctime(tup: struct_time_tuple11): typeof(asctime do: bind struct_time struct_time(tm_year: 1900, tm_mon: 1, tm_mday: 1, tm_yday: 1, tm_isdst: -1)) {. ...raises: [], tags: [], forbids: [].}
- Source Edit
proc strptime(s: string): struct_time {....raises: [ValueError, TimeParseError, TimeFormatParseError], tags: [TimeEffect], forbids: [].}
-
Warning: In current implementation, whitespace in format string means itself AS-IS, unlike C or Python, where any whitespace means a serial of any whitespaces. If really wanting the behavior of C's, consider using std/strscan.Warning: Current strptime is just locale-unaware, when it comes to "the locale's format", like "%x", it always uses the format of "C" locale, no matter what the locale is. a.k.a. Changing locale via C's api in <locale.h> doesn't affect this function.Source Edit
Exports
-
fetchDoc, fetchDoc, docTable, sleep, time, time_ns, perf_counter, monotonic_ns, perf_counter_ns, process_time, monotonic, <=, struct_time, <=, <, <, ==, <=, struct_time_tuple10, ==, repr, Some_struct_time, <=, ==, Some_struct_time_tuple, <, struct_time_tuple11, <=, ==, ==, <, <, struct_time_tuple, toTuple, localtime, mktime, mktime, localtime, gmtime, gmtime, gmtime, localtime, fetchDoc, strptime, strftime, strftime, docTable, fetchDoc, strftime