Important Update:
- Channels (FunctionCore & SelectableBare): - Added state "Standby", allow auto-managed handle to be opened - SelectableCore: - Set default "Persistent" state for sockets based on type - Remove Process() method (no different from SelectableBare - DateTimeCore: - Added BuildDateTimeStr() methods to build date for values - JSONparseCore: - Added error message to file operations
This commit is contained in:
@@ -371,6 +371,40 @@ bool ReadDateTimeStr( const char *DateTimeStr, unsigned char &Day, unsigned cha
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
char const * BuildDateStr( unsigned char Day, unsigned char Month, unsigned Year, const char * DateSeparator )
|
||||
{
|
||||
// Build String
|
||||
sprintf( ReturnStr, "%04d%s%02d%s%02d",
|
||||
Year, ((DateSeparator)? DateSeparator : ""), Month, ((DateSeparator)? DateSeparator : ""), Day );
|
||||
|
||||
// Return value
|
||||
return (ReturnStr);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
char const * BuildTimeStr( unsigned char Hours, unsigned char Minutes, unsigned char Seconds, const char * TimeSeparator )
|
||||
{
|
||||
// Build String
|
||||
sprintf( ReturnStr, "%02d%s%02d%s%02d",
|
||||
Hours, ((TimeSeparator)? TimeSeparator : ""), Minutes, ((TimeSeparator)? TimeSeparator : ""), Seconds );
|
||||
|
||||
return (ReturnStr);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
char const * BuildDateTimeStr( unsigned char Day, unsigned char Month, unsigned Year,
|
||||
unsigned char Hours, unsigned char Minutes, unsigned char Seconds,
|
||||
const char * DateSeparator, const char * TimeSeparator )
|
||||
{
|
||||
// Build String
|
||||
sprintf( ReturnStr, "%04d%s%02d%s%02d %02d%s%02d%s%02d",
|
||||
Year, ((DateSeparator)? DateSeparator : ""), Month, ((DateSeparator)? DateSeparator : ""), Day,
|
||||
Hours, ((TimeSeparator)? TimeSeparator : ""), Minutes, ((TimeSeparator)? TimeSeparator : ""), Seconds );
|
||||
|
||||
return (ReturnStr);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
// Get the current date in a string
|
||||
char const * BuildDateStr( const time_t EpochTime, bool LocalTime, const char * DateSeparator )
|
||||
{
|
||||
@@ -382,11 +416,7 @@ char const * BuildDateStr( const time_t EpochTime, bool LocalTime, const char *
|
||||
ReadDate( EpochTime, LocalTime, Day, Month, Year );
|
||||
|
||||
// Build String
|
||||
sprintf( ReturnStr, "%04d%s%02d%s%02d",
|
||||
Year, ((DateSeparator)? DateSeparator : ""), Month, ((DateSeparator)? DateSeparator : ""), Day );
|
||||
|
||||
// Return value
|
||||
return (ReturnStr);
|
||||
return BuildTimeStr( Year, Month, Day, DateSeparator );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
@@ -400,10 +430,7 @@ char const * BuildTimeStr( const time_t EpochTime, bool LocalTime, const char *
|
||||
ReadTime( EpochTime, LocalTime, Hours, Minutes, Seconds );
|
||||
|
||||
// Build String
|
||||
sprintf( ReturnStr, "%02d%s%02d%s%02d",
|
||||
Hours, ((TimeSeparator)? TimeSeparator : ""), Minutes, ((TimeSeparator)? TimeSeparator : ""), Seconds );
|
||||
|
||||
return (ReturnStr);
|
||||
return BuildTimeStr( Hours, Minutes, Seconds, TimeSeparator );
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
@@ -420,9 +447,5 @@ char const * BuildDateTimeStr( const time_t EpochTime, bool LocalTime, const cha
|
||||
ReadDateTime( EpochTime, LocalTime, Day, Month, Year, Hours, Minutes, Seconds );
|
||||
|
||||
// Build String
|
||||
sprintf( ReturnStr, "%04d%s%02d%s%02d %02d%s%02d%s%02d",
|
||||
Year, ((DateSeparator)? DateSeparator : ""), Month, ((DateSeparator)? DateSeparator : ""), Day,
|
||||
Hours, ((TimeSeparator)? TimeSeparator : ""), Minutes, ((TimeSeparator)? TimeSeparator : ""), Seconds );
|
||||
|
||||
return (ReturnStr);
|
||||
return BuildDateTimeStr( Year, Month, Day, Hours, Minutes, Seconds, DateSeparator, TimeSeparator );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user