Information Technology Reference
In-Depth Information
void IncrementTimeStamp(DIRENTRY dir)
{
byte seconds;
byte minutes;
byte hours;
byte day;
byte month;
byte year;
// Get the time and date information from the passed DIRENTRY structure.
seconds =
(dir -> DIR_WrtTime & 0x1f);
minutes =
((dir -> DIR_WrtTime & 0x07E0) >> 5);
hours =
((dir -> DIR_WrtTime & 0xF800) >> 11);
day =
(dir -> DIR_WrtDate & 0x1f);
month =
((dir -> DIR_WrtDate & 0x01E0) >> 5);
year =
((dir -> DIR_WrtDate & 0xFE00) >> 9);
// Increment the time.
// Seconds is in units of 2 seconds (0-29).
if (seconds < 29)
seconds++;
else
{
seconds = 0x00; // It's a new minute.
if (minutes < 59)
{
minutes++;
}
else
{
minutes = 0; // It's a new hour.
if (hours < 23)
{
hours++;
}
Search WWH ::




Custom Search