Result is 1900-01-01 (Mon) 12:00. I think that the Rainmeter assumes the Year-Month-Day as 1900-01-01 in the case of no YMD in the TimeStamp. Is it right?
If so, why 1900-01-01 instead of 1601-01-01 which is a start date of Windows time??
Ps. In the explanation of the format of TimeStamp in Rainmeter Documents, 3rd example is "2105" instead of "2015". Is it some joke or typo?
This is a limitation of some of the underlying structures the C++ standard libraries uses to convert time formats to other formats.
This limitation should only happen when using TimeStampFormat option. We will look at documenting it.
[Detail]
When "reading" date/time information from a string, the time libraries from the C++ standard decided to use a "standard" time structure that does not accept years before 1900. https://en.cppreference.com/w/c/chrono/tm
I won't comment on why different operating systems and programming languages use such a wide variety of underlying date/time structures and functions...but I will say that Rainmeter relies heavily on the Windows api (or winapi), and we tend to use the native date/time structures that Windows uses/requires. The winapi makes conversion fairly easy - even when we have to do some of the work to convert correctly between different structures. The winapi mainly uses 3 different types of date/time structures for various reasons. The tm stucture (referenced above), SYSTEMTIME and FILETIME are the most common.
[/Detail]
mak_kawa wrote: ↑April 28th, 2020, 12:45 am
Ps. In the explanation of the format of TimeStamp in Rainmeter Documents, 3rd example is "2105" instead of "2015". Is it some joke or typo?
It's not technically incorrect, but for consistency with the other dates, it has been fixed. It was probably just a typo.
Thank you for detailed explanation. I acknowledged that it depends on C++ standard library.
In fact I have no problem/difficulty with it, so it's alright as is. Adding description to the documents seems to be even better.
Really appreciate for spending your time responding such question just out of my curiosity.
After talking it over with jsmorley, and doing a little more research, we have come to the conclusion that the year 1900 is more of a "default" value in this case. It is perfectly acceptable to use TimeStampFormat with a 4 digit year format code %Y before the year 1990.
Personally, I think this default value is to accommodate the 2 digit %y year format code. In most use cases, a date with a 2 digit year, say 12/25/90, shouldn't parse to 1690, but to 1990.
These date "assumptions" should get interesting in about 50 years.
Brian wrote: ↑April 28th, 2020, 6:50 pmAfter talking it over with jsmorley, and doing a little more research, we have come to the conclusion that the year 1900 is more of a "default" value in this case. [...] Personally, I think this default value is to accommodate the 2 digit %y year format code. In most use cases, a date with a 2 digit year, say 12/25/90, shouldn't parse to 1690, but to 1990.
Yeah, this makes sense, actually - and it explains the behavior.
Brian wrote: ↑April 28th, 2020, 6:50 pmThese date "assumptions" should get interesting in about 50 years.
-Brian
Now that's an excellent point. It'll be like the AD era or the Hijri era, people will eventually say ... "Look, it all started in the nineties". I wouldn't mind that personally, as those times were one of the happiest (and creative) everywhere on the planet.
Sorry for bothering...and probably for my poor/broken English expression,
I have accidentally handled a timestamp without YMD to time measure, and received a start date of the 20th century. So I was curious why not 1601/01/01 which is a start date of the Windows time? It's all (as Yincognito said). I have no intention to convert timestamp without YMD to some relevant/rational date.
I apologize for that useless question merely out of my curiosity.
mak_kawa wrote: ↑April 28th, 2020, 9:23 pm
Hi jsmorley
Sorry for bothering...and probably for my poor/broken English expression,
I have accidentally handled a timestamp without YMD to time measure, and received a start date of the 20th century. So I was curious why not 1601/01/01 which is a start date of the Windows time? It's all (as Yincognito said). I have no intention to convert timestamp without YMD to some relevant/rational date.
I apologize for that useless question merely out of my curiosity.