diff options
author | Thomas Martitz <kugel@rockbox.org> | 2010-05-06 21:04:40 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2010-05-06 21:04:40 +0000 |
commit | 50a6ca39ad4ed01922aa4f755f0ca579788226cf (patch) | |
tree | c7881b015b220558167310345b162324c96be15a /firmware/common/timefuncs.c | |
parent | adb506df14aded06ed6e9ebf8540e6fd383ffd6a (diff) | |
download | rockbox-50a6ca39ad4ed01922aa4f755f0ca579788226cf.tar.gz rockbox-50a6ca39ad4ed01922aa4f755f0ca579788226cf.zip |
Move c/h files implementing/defining standard library stuff into a new libc directory, also standard'ify some parts of the code base (almost entirely #include fixes).
This is to a) to cleanup firmware/common and firmware/include a bit, but also b) for Rockbox as an application which should use the host system's c library and headers, separating makes it easy to exclude our files from the build.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25850 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/common/timefuncs.c')
-rw-r--r-- | firmware/common/timefuncs.c | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/firmware/common/timefuncs.c b/firmware/common/timefuncs.c index e423e016fd..42babbd8e3 100644 --- a/firmware/common/timefuncs.c +++ b/firmware/common/timefuncs.c | |||
@@ -103,43 +103,6 @@ int set_time(const struct tm *tm) | |||
103 | #endif /* RTC */ | 103 | #endif /* RTC */ |
104 | } | 104 | } |
105 | 105 | ||
106 | #if CONFIG_RTC | ||
107 | /* mktime() code taken from lynx-2.8.5 source, written | ||
108 | by Philippe De Muyter <phdm@macqel.be> */ | ||
109 | time_t mktime(struct tm *t) | ||
110 | { | ||
111 | short month, year; | ||
112 | time_t result; | ||
113 | static int m_to_d[12] = | ||
114 | {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334}; | ||
115 | |||
116 | month = t->tm_mon; | ||
117 | year = t->tm_year + month / 12 + 1900; | ||
118 | month %= 12; | ||
119 | if (month < 0) | ||
120 | { | ||
121 | year -= 1; | ||
122 | month += 12; | ||
123 | } | ||
124 | result = (year - 1970) * 365 + (year - 1969) / 4 + m_to_d[month]; | ||
125 | result = (year - 1970) * 365 + m_to_d[month]; | ||
126 | if (month <= 1) | ||
127 | year -= 1; | ||
128 | result += (year - 1968) / 4; | ||
129 | result -= (year - 1900) / 100; | ||
130 | result += (year - 1600) / 400; | ||
131 | result += t->tm_mday; | ||
132 | result -= 1; | ||
133 | result *= 24; | ||
134 | result += t->tm_hour; | ||
135 | result *= 60; | ||
136 | result += t->tm_min; | ||
137 | result *= 60; | ||
138 | result += t->tm_sec; | ||
139 | return(result); | ||
140 | } | ||
141 | #endif | ||
142 | |||
143 | void set_day_of_week(struct tm *tm) | 106 | void set_day_of_week(struct tm *tm) |
144 | { | 107 | { |
145 | int y=tm->tm_year+1900; | 108 | int y=tm->tm_year+1900; |