18#include <FreeNOS/User.h>
42 unsigned int year, month, day, hour, min, sec = 0, time;
86 time =
mktime(year, month, day, hour, min, sec);
87 n =
snprintf(tmp, size <
sizeof(tmp) ? size :
sizeof(tmp),
"%u", time);
102 return (val & 0x0f) + (val >> 4) * 10;
Abstract device class interface.
String m_identifier
Unique identifier for this Device.
Abstract Input/Output buffer.
FileSystem::Result write(const void *buffer, const Size size, const Size offset=ZERO)
Write bytes to the I/O buffer.
Arch::IO m_io
Port I/O object.
virtual FileSystem::Result read(IOBuffer &buffer, Size &size, const Size offset)
Read time.
virtual FileSystem::Result initialize()
Initialize the time device.
Time(const u32 inode)
Constructor.
unsigned char readCMOS(unsigned char addr)
Returns the value stored at the given address from the CMOS.
unsigned bcd2bin(unsigned char val)
Convert from binary coded decimal to binary form.
C unsigned long mktime(const unsigned int year, const unsigned int month, const unsigned int day, const unsigned int hour, const unsigned int min, const unsigned int sec)
Convert given time values to UNIX timestamp (seconds since epoch)
C int snprintf(char *buffer, unsigned int size, const char *fmt,...)
Write a formatted string into a buffer.
unsigned int u32
Unsigned 32-bit number.
unsigned int Size
Any sane size indicator cannot go negative.
#define RTC_PORT(x)
The base I/O port of the CMOS.
#define RTC_YEAR
Offset in the CMOS for the current year.
#define RTC_UIP
Update in progress flag.
#define RTC_DAY_OF_MONTH
Offset in the CMOS for the current day of the month.
#define RTC_SECONDS
Offset in the CMOS for the current number of seconds.
#define RTC_HOURS
Offset in the CMOS for the current number of hours.
#define RTC_STATUS_B
Offset in CMOS for the status B register.
#define CMOS_YEARS_OFFS
Assume that a two-digit year is after 2000.
#define RTC_MINUTES
Offset in the CMOS for the current number of minutes.
#define RTC_MONTH
Offset in the CMOS for the current month.
#define RTC_STATUS_A
Offset in CMOS for the status A register.
#define RTC_BCD
Time/date in binary/BCD flag.
Result
Result code for filesystem Actions.