LOADPATH  = [LOADPATH ':/home/ftp/pub/hmaser/prog'];
data = load_bin_floats('/tmp/.plotgps.tmpfile', 32, 40, 8, 'double');

endtime = max(data(:,1));
starttime = endtime - 60;

x2step = 10*24*3600;

data = data(find(data(:,1) >= starttime),:);
data = data(find(data(:,2) > 0),:);
data = data(find(data(:,2) < 5000),:);

starttime = min(data(:,1));

startsec = round((min(data(:,1)) - 51545)*24*60*60);
endsec = round((endtime - 51545)*24*60*60);

printf('set size 1,1\n');
%printf('set origin 0.1,0.1\n');
printf('set term pbm color\n');
printf('set output\n');

%printf('set tmargin 4\n');
%printf('set rmargin 10\n');
printf('set rmargin 5\n');

printf('set x2data time\n');
printf('set x2range [%.0f:%.0f]\n', startsec, endsec);
printf('set format x2 \'%%d %%b %%Y\'\n');
printf('set xrange [%f:%f]\n', starttime, endtime);
printf('set xtics nomirror\n');
printf('set x2tics nomirror\n'); %.0f, %.0f, %.0f\n', startsec, x2step, endsec);
printf('set nomxtics\n');
printf('set nomx2tics\n');
%printf('set grid\n');
printf('set x2label \'Time [UT]\'\n');
printf('set xlabel \'Time [MJD]\'\n');
printf('set ylabel \'Offset [us]\' 3\n');
printf('set title \'EFOS9 - GPS\'\n');
printf('set time\n');

printf('plot \'-\' notitle with lines\n');

for i = 1:length(data)
  printf('%f %f\n', data(i,1), data(i,2));
end
printf('e\n');
%keyboard

%plot(data(:,1), data(:,2));

