public function testToBerlinTimezone(){
		// should be 01 not 02!!
		$d = new ADateTime("2004-08-05 02:06:14");
		$d->toTimezone(1);

		$this->assertEqual($d->year(), 2004, "info is correct");
		$this->assertEqual($d->month(), 8, "info is correct");
		$this->assertEqual($d->day(), 5, "info is correct");
		$this->assertEqual($d->hour(), 3, "info is correct");
		$this->assertEqual($d->minute(), 6, "info is correct");
		$this->assertEqual($d->second(), 14, "info is correct");
	}
	public function longQuery($time, $sql){
		$now = new ADateTime();
		$sql2 = "INSERT INTO long_queries (`query`,`time`,`stamp`) VALUES ('" . addslashes($sql) . "', '" . addslashes($time) . "','" . addslashes(substr($now->toString(),11)) . "')";
		$this->mysql->query($sql2);
	}
	/**
	 * this will return the timestamp, assuming hour, minute and second are 0
	 * IE, this will round down to the nearest day
	 */
	public function getTimeStampFloor(){
		$dt = new ADateTime(substr($this->toString(), 0, 10) . " 00:00:00");
		return $dt->getTimeStamp();
	}
	private function processXML($zip, $xml){
		$this->model->getLogger()->log($this->model, ALogger::$NORMAL, "getting weather for: " . $zip . ":" . $xml);

		$xml = simplexml_load_string($xml);

		$city = "unknown";
		$state = "";

		foreach ($xml->xpath('//channel/yweather:location') as $location) {
			$attributes = $location->attributes();
			$city = "";
			$state = "";
			foreach($attributes as $k=>$v) {
				if($k == "city"){
					$city = (string) $v;
				}else
				if($k == "region"){
					$state = (string) $v;
				}
			}
		}
		
		$this->city = $city;
		$this->state = $state;
		
		foreach($xml->channel->item as $item){
			$date = "";
			$code = "";
			foreach ($item->xpath('//yweather:condition') as $condition) {
				$attributes = $condition->attributes();
				$code = -1;
				foreach($attributes as $k=>$v) {
					if($k == "date"){
						$date = (string) $v;
						$date = substr($date, 0, strlen($date) - 4);
						$date = strtotime($date);
						$date = new ADateTime(date("Y-m-d 00:00:00", $date));
					}else
					if($k == "code"){
						$code = (int) (string) $v;
					}
				}
			}
			$this->weather[] = array($date, $code);

			foreach ($item->xpath('//yweather:units') as $forecast) {
				$attributes = $forecast->attributes();
				$unit = "F";
				foreach($attributes as $k=>$v) {
					if($k == "temperature"){
						$unit = (string) $v;
					}
				}
			}

			foreach ($item->xpath('//yweather:condition') as $forecast) {
				$attributes = $forecast->attributes();
				$temperature = -1;
				$text = "";
				foreach($attributes as $k=>$v) {
					if($k == "temp"){
						$temperature = (int) (string) $v;
					}else
					if($k == "text"){
						$text = (string) $v;
					}
				}
				$this->temperature[] = array($date, $temperature, $temperature, $unit);
				$this->description[] = array($date, $text);
			}


			$today = $date;
			if(!is_object($today)){
				$today = new ADateTime();
				$today->hour(0);
				$today->minute(0);
				$today->second(0);
			}
			
			
			foreach ($item->xpath('//yweather:forecast') as $forecast) {
				$attributes = $forecast->attributes();
				$date = false;
				$code = -1;
				$low = -1;
				$high = -1;
				$text = "";
				foreach($attributes as $k=>$v) {
					if($k == "date"){
						$date = strtotime((string) $v);
						$date = new ADateTime(gmdate("Y-m-d 00:00:00", $date));
					}else
					if($k == "code"){
						$code = (int) (string) $v;
					}else
					if($k == "low"){
						$low = (int) (string) $v;
					}else
					if($k == "high"){
						$high = (int) (string) $v;
					}else
					if($k == "text"){
						$text = (string) $v;
					}
				}
				if(!is_object($date)){
					$date = $today;
				}
				if($date->toString() != $today->toString()){
					$this->weather[] = array($date, $code);
					$this->temperature[] = array($date, $low, $high, $unit);
					$this->description[] = array($date, $text);
				}
			}


		}			
		
		$ret = new Weather($this->city, $this->state, $this->weather, $this->description, $this->temperature);
		return $ret;
	}