- more notice stuff

svn path=/trunk/boinc/; revision=20011
This commit is contained in:
David Anderson 2009-12-22 17:11:59 +00:00
parent 3210912d76
commit 711430b081
2 changed files with 48 additions and 37 deletions

View File

@ -533,7 +533,6 @@ int ACTIVE_TASK::write(MIOFILE& fout) {
" <active_task_state>%d</active_task_state>\n"
" <app_version_num>%d</app_version_num>\n"
" <slot>%d</slot>\n"
" <pid>%d</pid>\n"
" <checkpoint_cpu_time>%f</checkpoint_cpu_time>\n"
" <checkpoint_elapsed_time>%f</checkpoint_elapsed_time>\n"
" <fraction_done>%f</fraction_done>\n"
@ -547,7 +546,6 @@ int ACTIVE_TASK::write(MIOFILE& fout) {
task_state(),
app_version->version_num,
slot,
pid,
checkpoint_cpu_time,
checkpoint_elapsed_time,
fraction_done,

View File

@ -23,6 +23,7 @@
#include "filesys.h"
#include "client_state.h"
#include "client_msgs.h"
#include "file_names.h"
#include "cs_notice.h"
@ -111,9 +112,15 @@ void RSS_FEED::read_feed_file() {
int RSS_FEED::parse_desc(XML_PARSER& xp) {
char tag[256];
bool is_tag;
strcpy(url, "");
poll_interval = 0;
while (!xp.get(tag, sizeof(tag), is_tag)) {
if (!is_tag) continue;
if (!strcmp(tag, "/notice_feed")) return 0;
if (!strcmp(tag, "/notice_feed")) {
if (!poll_interval) return ERR_XML_PARSE;
if (!strlen(url)) return ERR_XML_PARSE;
return 0;
}
if (xp.parse_str(tag, "url", url, sizeof(url))) continue;
if (xp.parse_double(tag, "poll_interval", poll_interval)) continue;
}
@ -229,7 +236,13 @@ int parse_notice_feeds(MIOFILE& fin, vector<RSS_FEED>& feeds) {
if (!strcmp(tag, "notice_feed")) {
RSS_FEED rf;
retval = rf.parse_desc(xp);
if (!retval) {
if (retval) {
if (log_flags.sched_op_debug) {
msg_printf(0, MSG_INFO,
"[sched_op_debug] error in <notice_feed> element"
);
}
} else {
feeds.push_back(rf);
}
}
@ -355,39 +368,39 @@ void handle_sr_feeds(vector<RSS_FEED>& feeds, PROJECT* p) {
#ifdef _WIN32
// compensate for lameness
static int month_index(char* x) {
if (strstr(x, "Jan")) return 0;
if (strstr(x, "Feb")) return 1;
if (strstr(x, "Mar")) return 2;
if (strstr(x, "Apr")) return 3;
if (strstr(x, "May")) return 4;
if (strstr(x, "Jun")) return 5;
if (strstr(x, "Jul")) return 6;
if (strstr(x, "Aug")) return 7;
if (strstr(x, "Sep")) return 8;
if (strstr(x, "Oct")) return 9;
if (strstr(x, "Nov")) return 10;
if (strstr(x, "Dev")) return 11;
return 0;
}
static int parse_rss_time(char* buf) {
char day_name[64], month_name[64];
int day_num, year, h, m, s;
int n = sscanf(buf, "%s %d %s %d %d:%d:%d",
day_name, &day_num, month_name, &year, &h, &m, &s
);
printf("n: %d\n", n);
struct tm tm;
tm.tm_sec = s;
tm.tm_min = m;
tm.tm_hour = h;
tm.tm_mday = day_num;
tm.tm_mon = month_index(month_name);
tm.tm_year = year-1900;
tm.tm_wday = 0;
tm.tm_yday = 0;
static int month_index(char* x) {
if (strstr(x, "Jan")) return 0;
if (strstr(x, "Feb")) return 1;
if (strstr(x, "Mar")) return 2;
if (strstr(x, "Apr")) return 3;
if (strstr(x, "May")) return 4;
if (strstr(x, "Jun")) return 5;
if (strstr(x, "Jul")) return 6;
if (strstr(x, "Aug")) return 7;
if (strstr(x, "Sep")) return 8;
if (strstr(x, "Oct")) return 9;
if (strstr(x, "Nov")) return 10;
if (strstr(x, "Dev")) return 11;
return 0;
}
static int parse_rss_time(char* buf) {
char day_name[64], month_name[64];
int day_num, year, h, m, s;
int n = sscanf(buf, "%s %d %s %d %d:%d:%d",
day_name, &day_num, month_name, &year, &h, &m, &s
);
printf("n: %d\n", n);
struct tm tm;
tm.tm_sec = s;
tm.tm_min = m;
tm.tm_hour = h;
tm.tm_mday = day_num;
tm.tm_mon = month_index(month_name);
tm.tm_year = year-1900;
tm.tm_wday = 0;
tm.tm_yday = 0;
tm.tm_isdst = 0;
int t = mktime(&tm);