|
|
Home » U++ Library support » U++ Core » Time and Date
Time and Date [message #11277] |
Thu, 30 August 2007 11:53 |
mrjt
Messages: 705 Registered: March 2007 Location: London
|
Contributor |
|
|
I've been looking at making a patch to fix EditTime and and some other related stuff, but I've hit a serious problem - There is no way to represent just a time in Upp. For instance:
Time t;
t.hour = 14;
t.minute = 13;
t.second = 12;
time <<= t;
bool isvalid = t.IsValid();
bool isnull = IsNull(t);
String asstring = AsString(t);
Output:
isvalid = true
isnull = true
asstring = null
This is caused by:
template<> inline bool IsNull(const Time& t) { return t.year == -32768; }
Personally I think Date and Time should be seperated (and have an additional DateTime class) but can see this might be impractical at this stage. However, could this also be fixed by having a null state for Time (like minute or second >= 60) and test for that instead?
James
[Updated on: Thu, 30 August 2007 12:16] Report message to a moderator
|
|
|
Re: Time and Date [message #11280 is a reply to message #11277] |
Thu, 30 August 2007 16:27 |
|
mirek
Messages: 13975 Registered: November 2005
|
Ultimate Member |
|
|
Hm, what about representing the time just by number of seconds?
In fact, the main purpose of both Date and Time structs is that they understand calendar...
As for Time representing just time in day, well, maybe it would be sound design choice, however, right now, it is too late for such radical change. If number of second is not going to help here, we have to invent some new name, like "TimeInDay" or something...
Mirek
|
|
|
|
|
|
Goto Forum:
Current Time: Fri Mar 29 15:32:00 CET 2024
Total time taken to generate the page: 0.03239 seconds
|
|
|