Talk:cpp/chrono/time point

If the example code was for production, I would agree with its use of auto. However, for example code, the auto obscures the concepts that the example is trying to convey. I believe the following code (that only replaces auto) may be a more useful example.

By the way, the comment on the using namespace is perfect.

24.246.171.55 03:36, 15 February 2021 (PST) Unferth
 * Sounds more than reasonable.) ✅ Thank you. --Space Mission (talk) 10:09, 15 February 2021 (PST)
 * I think it was bad idea. Old example showed good concise way of using `now`, as it will be used in real word. -- Valiko (talk) 05:55, 16 February 2021 (PST)
 * If adding a production code version, perhaps as comments? (130.76.24.18 09:11, 24 February 2021 (PST))
 * Updated, once again.) In Examples the actual types exposure is more useful, IMO. After all, the replacement with for real-code hardly can cause any trouble. --Space Mission (talk) 16:08, 24 February 2021 (PST)
 * This site is not tutorial on C++, so IMO those long types only distract attention from the essential points. Please also look at the "What is the purpose of this site?" in Cppreference:FAQ -- Valiko (talk) 05:34, 25 February 2021 (PST)

Completely disagree with adding those comments, I think they just add noise to the example, and I don't think anyone needs to be told how to replace a type with auto. Regarding auto type deduction vs explicit types, I think explicit types are more demonstrative, having an example that doesn't even mention the type being documented would be rather embarrassing. I would however encourage the idea of omitting the template arguments (std) and relying on CTAD, I don't think they're adding any demonstrative value. --Ybab321 (talk) 08:23, 25 February 2021 (PST)


 * In the example, one can always click on "std::chrono::system_clock::now" and see what type it returns, no need to explicitly mention that long type. Like iterators (just one more example). -- Valiko (talk) 11:49, 25 February 2021 (PST)


 * Whilst it's true that you can click all of the links of functions to see what they return, I think it would be more convenient to the reader to save them the effort. I'm no authority here, but I believe an example should show an enlightening example of how a std could be used, not how to a half-assed execution time measurement or how to call std or any of the other stuff in the example. To that end, I think it makes the most sense for the std type to be spelled out and for the reader to know what they're looking at and see what they're looking for at a glance. --Ybab321 (talk) 13:20, 25 February 2021 (PST)

Return value speaks of, but not defined
For the member functions, and , the return value states:

 rounded to nearest time point using duration of type ...

yet is not described. is the parameter, and I'd understand if were a duration. Can someone clarify?

ticotico (talk) 08:17, 14 June 2022 (PDT)


 * Looks like a copy paste error from the respective duration pages --Ybab321 (talk) 09:12, 14 June 2022 (PDT)