Monday, November 08, 2010 at 12:05 AM.

system.verbs.builtins.radio.weblog.getSkipHours

on getSkipHours (adrblog=radio.weblog.init ()) {
	<<Changes
		<<12/16/02; 3:49:48 AM by DW
			<<For European users (with positive timezones), we sometimes get negative numbers from the mod operator; so add special logic that mods negative hours into positive ones.
		<<11/9/02; 7:47:17 AM by DW
			<<If we have enough data in weblogData.stats.hourlyUpdateCounts, generate a list of hours aggregators can skip.
			<<Returns the empty list if disabled or not enough data, or if there's an error.
	try {
		if not adrblog^.prefs.flGenerateSkipHours { //feature disabled
			return ({})};
		local (counts = adrblog^.stats.hourlyUpdateCounts, i);
		bundle { //if total number of updates is less than 100, don't bother
			local (cttotal = 0);
			for i = 1 to sizeof (counts) {
				cttotal = cttotal + counts [i]};
			if cttotal < 100 {
				return ({})}};
		bundle { //sort the counts
			local (oldtarget = target.set (@counts));
			table.sortby ("Value");
			target.set (oldtarget)};
		bundle { //build and return the list
			local (skiplist = {}, tz = (date.getCurrentTimeZone () / 3600));
			tz = 1; //debugging
			for i = 1 to adrblog^.prefs.ctSkipHours {
				h = number (nameof (counts [i]));
				h = ((h - tz) % 24);
				if h < 0 { //12/16/02 by DW
					h = 24 + h};
				skiplist = skiplist + h};
			return (skiplist)}}
	else {
		return ({})}};
bundle { //test code
	dialog.alert (getSkipHours ())}



This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.