Skip to content

Commit

Permalink
WIP step 7
Browse files Browse the repository at this point in the history
Validation complete avec ancien format
  • Loading branch information
marcboulle committed Nov 28, 2023
1 parent d8c7089 commit d3a3a68
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
7 changes: 4 additions & 3 deletions src/Learning/KWData/KWTime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ const char* const KWTimeFormat::TimeToString(Time tmValue) const
{
char* sBuffer = StandardGetBuffer();
int nOffset;
const double dEpsilon = 1e-5;
const double dEpsilon = 0.5 / DateTime::nMaxFracSeconds;
int nSecond;
int nSecondFrac;
int i;
Expand Down Expand Up @@ -709,11 +709,12 @@ const char* const KWTimeFormat::TimeToString(Time tmValue) const
// Ecriture des fractions de secondes
if (nSecondFrac > 0)
{
nOffset += snprintf(sBuffer + nOffset, BUFFER_LENGTH - nOffset, ".%04d", nSecondFrac);
nOffset += snprintf(sBuffer + nOffset, BUFFER_LENGTH - nOffset, ".%0*d",
DateTime::nFracSecondsDigitNumber, nSecondFrac);

// Supression des zero en fin pour ne garder que la partie utile des decimales de
// secondes
for (i = 0; i < 4; i++)
for (i = 0; i < DateTime::nFracSecondsDigitNumber; i++)
{
if (sBuffer[nOffset - 1 - i] == '0')
sBuffer[nOffset - 1 - i] = '\0';
Expand Down
2 changes: 1 addition & 1 deletion src/Learning/KWData/KWTime.h
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ inline void Time::SetMinute(int nValue)

inline void Time::SetSecond(double dValue)
{
const double dEpsilon = 1e-5;
const double dEpsilon = 0.5 / DateTime::nMaxFracSeconds;
int nSecond;
int nSecondFrac;
require(0 <= dValue and dValue < 60);
Expand Down
4 changes: 0 additions & 4 deletions src/Learning/KWData/KWTimestamp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,6 @@ void Timestamp::Test()
int nTotalLeapDayNumber;
int nTotalSecondNumber;

//DDD
tsCurrent.Init(2012, 01, 01, 21, 38, 20.3);
cout << "BUG: " << tsCurrent.ToString() << endl;

cout << "sizeof(Timestamp): " << sizeof(Timestamp) << endl;
//DDD assert(sizeof(Timestamp) == sizeof(Date) + sizeof(Time));
assert(sizeof(Timestamp) == sizeof(longint));
Expand Down
2 changes: 1 addition & 1 deletion src/Learning/MODL/MODL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ int main(int argc, char** argv)
// Choix du repertoire de lancement pour le debugage sous Windows (a commenter apres fin du debug)
// SetWindowsDebugDir("Standard", "IrisLight");
// SetWindowsDebugDir("Standard", "Iris2D");
SetWindowsDebugDir("z_Work", "TimestampBUG");
SetWindowsDebugDir("Rules", "DateTimeRules");

// Parametrage des logs memoires depuis les variables d'environnement, pris en compte dans KWLearningProject
// KhiopsMemStatsLogFileName, KhiopsMemStatsLogFrequency, KhiopsMemStatsLogToCollect
Expand Down

0 comments on commit d3a3a68

Please sign in to comment.