/**
  * @static
  * returns a Timestamp object with the blog time difference already
  * applied, if needed
  *
  * @param blog either a blog id or a BlogInfo object
  * @param timestamp 
  * @return A Timestamp object with time difference applied, if needed
  * @see BlogInfo
  */
 function getBlogDate($blog, $timestamp = null)
 {
     // check whether time differences are dynamically or statically
     // applied, because in case of the former, we don't have to do
     // anything here!
     $config =& Config::getConfig();
     if ($config->getValue("time_difference_calculation") == TIME_DIFFERENCE_CALCULATION_DYNAMIC) {
         return new Timestamp($timestamp);
     }
     //
     // how's this for function overloading??
     // I know it's quite hackish, but it's a bit of a pain that
     // we need to define two different functions depending on whether
     // we're getting an object or an integer!
     //
     if (is_object($blog)) {
         $blogSettings = $blog->getSettings();
         $timeDifference = $blogSettings->getValue("time_offset");
     } else {
         include_once PLOG_CLASS_PATH . "class/dao/blogs.class.php";
         $blogs = new Blogs();
         $blogInfo = $blogs->getBlogInfoById($blog);
         if (!$blogInfo) {
             $timeDifference = 0;
         } else {
             $blogSettings = $blogInfo->getSettings();
             $timeDifference = $blogSettings->getValue("time_offset");
         }
     }
     // generate the date with the correct time difference applied
     $t = new Timestamp();
     $t->setDate(Timestamp::getDateWithOffset($t->getDate(), $timeDifference), DATE_FORMAT_TIMESTAMP);
     return $t;
 }