Non-Commercial Use:
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 Commercial Use:
    Please contact sunkid@iminurnetz.com
*/
require "../nbt.class.php";
$nbt = new nbt();
// change to point to your world's level.dat file
$nbt->loadFile("/minecraft/world/level.dat");
foreach ($nbt->root[0]['value'][0]['value'] as $dat) {
    $t = $dat['value'];
    if ($dat['name'] === 'Time') {
        $time = $t;
    }
    if ($dat['name'] === 'LastPlayed') {
        $last = $t;
        $now = microtime(true);
    }
}
$time = $time + ($now * 1000 - $last) / 50;
printf("[%d]\n", $time);
<?php

error_reporting(E_ALL);
require "nbt.class.php";
$nbt = new nbt();
$nbt->verbose = true;
$nbt->loadFile("smalltest.nbt");
$nbt->loadFile("bigtest.nbt");
$nbt->writeFile($tmp = tempnam(sys_get_temp_dir(), "nbt"));
echo "Small Test" . PHP_EOL;
print_r($nbt->root[0]);
echo "Big Test" . PHP_EOL;
print_r($nbt->root[1]);
<?php

// hope you enjoy a lack of comments, cause i didn't comment this one very well at all. Pretty simple file though.
// Michael Writhe <michael [at] writhem [dot] com>
// requires the nbt class which can be downloaded from frozenfire's svn server:
// http://svn.thefrozenfire.com/minecraft/NBT/trunk/
require "../nbt.class.php";
$nbt = new nbt();
// change to point to your world's level.dat file
$nbt->loadFile("<serverDIR>/level.dat");
$a = array();
foreach ($nbt->root[0]['value'][0]['value'] as $dat) {
    $t = $dat['value'];
    if ($dat['name'] === "raining") {
        $a['raining'] = $dat['value'] == 0 ? false : true;
    }
    if ($dat['name'] === "rainTime") {
        $a['rainTime'] = $dat['value'];
    }
    if ($dat['name'] === "thundering") {
        $a['thundering'] = $dat['value'] == 0 ? false : true;
    }
    if ($dat['name'] === "thunderTime") {
        $a['thunderTime'] = $dat['value'];
    }
    if ($dat['name'] === 'Time') {
        $a['time'] = abs((double) $dat['value'] % 24000);
    }
    /*
    if ($dat['name'] === 'version') {
        $a['debug'] = $dat['value'];