PDA

View Full Version : Your computer clock maybe wrong......



enoughfakefiles
11-30-2004, 08:46 PM
Mines definatly well out if this is true.

http://img52.exs.cx/img52/8122/Untitled-1copy120.jpg

:lol: :lol:

Mathea
11-30-2004, 08:48 PM
mine is always wrong

i fix it n then within 24 hours its wrong again so i finally gave up

bigboab
11-30-2004, 08:53 PM
Mine is feckin accurate. It synchronizes with one of those atomic chaps.Dont you mean atomic chips. Or is that fission chips.:wacko:

TheDave
11-30-2004, 08:54 PM
i think mine synchronises when it reports my porn to microsoft :huh:

TheDave
11-30-2004, 08:57 PM
http://img.photobucket.com/albums/v210/TheDave/synctime.jpg

yep it does

enoughfakefiles
11-30-2004, 08:59 PM
http://img.photobucket.com/albums/v210/TheDave/synctime.jpg

yep it does

Windows 2000 doesn`t have that option. :angry:

TheDave
11-30-2004, 09:01 PM
fyi its 21:20:42

Tifosi
11-30-2004, 09:10 PM
import java.net.*;
import java.io.*;
import java.util.*;

class Time
{
/* Network time is seconds from 1 Jan 1900
* Java time is milliseconds from 1 Jan 1970
* DIFFERENCE is number of seconds between these dates
*/
static long DIFFERENCE = 2208988800L;

public static void main (String [] args ) throws IOException
{
int b1,b2,b3,b4;
long remoteTime;

Socket sock = new Socket("time.nist.gov",37);
InputStream in = sock.getInputStream();

// read and pack four bytes
b1 = in.read();
b2 = in.read();
b3 = in.read();
b4 = in.read();

remoteTime = (((long)b1*256 + b2)*256 + b3)*256 + b4;
remoteTime -= DIFFERENCE;
sock.close();

Date remoteDate = new Date(remoteTime*1000); // convert to milliseconds
System.out.println("Remote time: "+remoteDate);
Date localTime = new Date();
System.out.println("Local time: "+localTime);
}
}


:P

TheDave
11-30-2004, 09:13 PM
that a java thing that syncs time for win 2000?

Tifosi
11-30-2004, 09:15 PM
that a java thing that syncs time for win 2000?

It doesn't sync the time, just displays the remote time from the time server and then your own local system time, allowing you to see the difference.

TheDave
11-30-2004, 09:17 PM
could be made to sync time though :unsure:

i started teaching myself java then errr stopped :(

Tifosi
11-30-2004, 09:19 PM
Sample output

DarthInsinuate
11-30-2004, 09:19 PM
http://img.photobucket.com/albums/v210/TheDave/synctime.jpg

yep it does
i broke mine, Windows won't ever have the precision of 10 seconds again :(

Tifosi
11-30-2004, 09:21 PM
could be made to sync time though :unsure:

i started teaching myself java then errr stopped :(

Yeah, I suppose it could be modified to sync the time. I've been learning java for about a year and a half now, but they don't teach us much to do with interaction with windows (and I can't be fecked learning :no: )

TheDave
11-30-2004, 09:23 PM
i wish they taught it in pill form, that would be cool :01:

enoughfakefiles
11-30-2004, 09:25 PM
i wish they taught it in pill form, that would be cool :01:

The blue pill or the red pill. :ph34r:

Tifosi
11-30-2004, 09:27 PM
import java.io.*;

public class FileMover
{
public static void main (String[] args) throws IOException
{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

System.out.print("Enter the filename you wish to move: ");
String fileToBeMoved = in.readLine();
File file = new File (fileToBeMoved);

while(!file.exists())
{
System.out.println("The file you've entered does not exist.\nPlease try again: ");
fileToBeMoved = in.readLine();
file = new File (fileToBeMoved);
}

long fileLength = file.length();

System.out.print("Enter the destination path: ");
String destpath = in.readLine();

File dir = new File(destpath);

String pathname = file.getAbsolutePath();

System.out.println("\nYou are about to move: \n\n"+pathname+"\nto \n"+destpath);
System.out.print("\nIf you're happy with this, enter 'y' to proceed.\nOtherwise press 'n' to cancel: ");

char userInput = (char) System.in.read();

if(userInput == 'y')
{
double start = System.currentTimeMillis();
boolean fine = file.renameTo(new File(dir, file.getName()));
double end = System.currentTimeMillis();
double timeTaken = (end - start)/1000;

if(fine)
{
if(timeTaken > 0)
{
double transferRate = ((fileLength/1024)/timeTaken);
System.out.println("\nFile "+fileToBeMoved+" is "+fileLength+" bytes and took "+timeTaken+" seconds to move");
System.out.println("Average transfer rate was "+Math.round(transferRate)+" kB/sec");
}
else
System.out.println("\nFile moved successfully");
}
else
System.out.println("\nFile not moved");
}
else
System.out.println("\nYou have cancelled the move\n");
}
}


A FileMoving program I made. It takes about 50-75% of the time windows takes to move the same file (which is quite surprising considering how slow java is in comparison to 'real' languages)

Tifosi
11-30-2004, 09:37 PM
import java.io.*;

public class FileMover
{
public static void main (String[] args) throws IOException
{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
// Set up BufferedReader to take user input

System.out.print("Enter the filename you wish to move: ");

String fileToBeMoved = in.readLine();
// Read in the pathname from a user of the file they wish to move

File file = new File (fileToBeMoved);
// Create a new file object with the path from above

while(!file.exists()) // While they don't enter a real file
{
System.out.println("The file you've entered does not exist.\nPlease try again: ");
// Tell them they didn't enter a real file
fileToBeMoved = in.readLine();
// Read in a new pathname

file = new File (fileToBeMoved);
// Create new file object...
}

long fileLength = file.length();
// Get length of the file to be moved

System.out.print("Enter the destination path: ");
String destpath = in.readLine();
// Read in destination path from user

File dir = new File(destpath);
// Create a new using the destination path from the user

String pathname = file.getAbsolutePath();
// Get the full path of the file the user inputs (e.g. C:\Windows\System32\winmine.exe)

System.out.println("\nYou are about to move: \n\n"+pathname+"\nto \n"+destpath);
System.out.print("\nIf you're happy with this, enter 'y' to proceed.\nOtherwise press 'n' to cancel: ");

char userInput = (char) System.in.read();
// Read in one char from the user

if(userInput == 'y') // If the user enters a 'y' (i.e. they want to move the file)
{
double start = System.currentTimeMillis();
// Get current system time (to be used in calculation later

boolean fine = file.renameTo(new File(dir, file.getName()));
// Move the file (by renaming the path)
// Set the boolean value "fine" to true if the transfer goes OK, otherwise set it to false

double end = System.currentTimeMillis();
// Get current system time (after the move operation)

double timeTaken = (end - start)/1000;
// Calculate how long it took to move the file (division by 1000 gives result in seconds)

if(fine) // If the file move went OK
{
if(timeTaken > 0) // If it took more than "0" time to move (to counter possible division by 0)
{
double transferRate = ((fileLength/1024)/timeTaken);
// Calculate transfer rate for the file

System.out.println("\nFile "+fileToBeMoved+" is "+fileLength+" bytes and took "+timeTaken+" seconds to move");
System.out.println("Average transfer rate was "+Math.round(transferRate)+" kB/sec");
}
else // If it didn't take more than "0" seconds
System.out.println("\nFile moved successfully");
}
else // If "fine" is false (i.e. if there was a problem with the move
System.out.println("\nFile not moved");
}
else // If the user cancelled the transfer (by entering other than 'y' above)
System.out.println("\nYou have cancelled the move\n");
}
}


Commented version of above (if anyone wants to learn anything from it :lol:

Sample run (obviously it's simple with no real GUI):

lynx
11-30-2004, 11:49 PM
import java.io.*;

public class FileMover
{
public static void main (String[] args) throws IOException
{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

System.out.print("Enter the filename you wish to move: ");
String fileToBeMoved = in.readLine();
File file = new File (fileToBeMoved);

while(!file.exists())
{
System.out.println("The file you've entered does not exist.\nPlease try again: ");
fileToBeMoved = in.readLine();
file = new File (fileToBeMoved);
}

long fileLength = file.length();

System.out.print("Enter the destination path: ");
String destpath = in.readLine();

File dir = new File(destpath);

String pathname = file.getAbsolutePath();

System.out.println("\nYou are about to move: \n\n"+pathname+"\nto \n"+destpath);
System.out.print("\nIf you're happy with this, enter 'y' to proceed.\nOtherwise press 'n' to cancel: ");

char userInput = (char) System.in.read();

if(userInput == 'y')
{
double start = System.currentTimeMillis();
boolean fine = file.renameTo(new File(dir, file.getName()));
double end = System.currentTimeMillis();
double timeTaken = (end - start)/1000;

if(fine)
{
if(timeTaken > 0)
{
double transferRate = ((fileLength/1024)/timeTaken);
System.out.println("\nFile "+fileToBeMoved+" is "+fileLength+" bytes and took "+timeTaken+" seconds to move");
System.out.println("Average transfer rate was "+Math.round(transferRate)+" kB/sec");
}
else
System.out.println("\nFile moved successfully");
}
else
System.out.println("\nFile not moved");
}
else
System.out.println("\nYou have cancelled the move\n");
}
}


A FileMoving program I made. It takes about 50-75% of the time windows takes to move the same file (which is quite surprising considering how slow java is in comparison to 'real' languages)
The only reason that java is slower than 'real' languages is because it has to be interpreted first. If that is a relatively small part of the procedure compared to the actual work done there is no reason why it shouldn't work almost as fast.

Your claim that it is faster than windows doing the same file move is almost certainly wrong. When windows moves a file, it has actually finished moving it when it says it has finished. In contrast the java program hands that task over to windows. Windows will have cached some of the move and allowed the java program to continue. Windows will still be moving the file while your program is waiting for you to "Press any key to continue...".
:P

ZaZu
12-01-2004, 12:46 AM
The gov time server is the atomic one not Microsloth

http://img75.exs.cx/img75/7362/time5.jpg

GepperRankins
12-01-2004, 12:49 AM
the forum clock is now right, but 15 seconds lasts 20 minutes

manker
12-01-2004, 12:52 AM
the forum clock is now right, but 15 seconds lasts 20 minutes
:blink: :blink:

:blink:

:blink: :blink: :blink:

ElvisLover
12-01-2004, 12:53 AM
the forum clock is now right, but 15 seconds lasts 20 minutes


You're stuck too?

i think when the clock went forawrd and back it caused a negative time vortex

enoughfakefiles
12-01-2004, 12:56 AM
http://dspace.dial.pipex.com/scarecrow/whogame/tardis.jpg

Maybe we`ve landed on gallyfray. :ph34r:

GepperRankins
12-01-2004, 12:59 AM
i cant wait till halo 2 comes out. any news on a half-life 2 release date yet?

manker
12-01-2004, 12:59 AM
Oh I get it now.

Flood control isn't affecting me, btw.

GepperRankins
12-01-2004, 01:00 AM
wait. its still 20 minutes out

enoughfakefiles
12-01-2004, 01:01 AM
wait. its still 20 minutes out

That means it`s back to normal. :lol: :lol:

GepperRankins
12-01-2004, 01:03 AM
this reminds me of next month's ctrlaltdel-online

tesco
12-01-2004, 02:06 AM
The only reason that java is slower than 'real' languages is because it has to be interpreted first. If that is a relatively small part of the procedure compared to the actual work done there is no reason why it shouldn't work almost as fast.

Your claim that it is faster than windows doing the same file move is almost certainly wrong. When windows moves a file, it has actually finished moving it when it says it has finished. In contrast the java program hands that task over to windows. Windows will have cached some of the move and allowed the java program to continue. Windows will still be moving the file while your program is waiting for you to "Press any key to continue...".
:P
shh. :P

DanB
12-01-2004, 02:14 AM
free again :01:

Tifosi
12-01-2004, 06:56 AM
The only reason that java is slower than 'real' languages is because it has to be interpreted first. If that is a relatively small part of the procedure compared to the actual work done there is no reason why it shouldn't work almost as fast.

Your claim that it is faster than windows doing the same file move is almost certainly wrong. When windows moves a file, it has actually finished moving it when it says it has finished. In contrast the java program hands that task over to windows. Windows will have cached some of the move and allowed the java program to continue. Windows will still be moving the file while your program is waiting for you to "Press any key to continue...".
:P

A JIT compiler goes some way to solving the speed problems related to Java.

In the "real world" Java programs take around about 10 times as long to execute as programs written in C/C++ (when you're not using a JIT compiler).

As for the time taken to move the files, I had suspected that the program would take the same amount of time (or even longer) than windows, however, it always takes less time. I don't think you're correct in saying that the move will not be complete after my program has finished execution, since the file is available to be used as soon as the program has finished execution

Ariel_001
12-01-2004, 12:54 PM
Do not use any gator crap!!! Try this: Timesync. Works in any version of Windows NT family (NT, 2000, XP). It runs as a service to sync with a time server at a given interval..

http://img34.exs.cx/img34/120/time.png

Run the installer...

Go to the control panel -> Click TimeSync icon.
Click the "Use new SNTP" button and add:

time.windows.com
time.nist.gov

If it is not already there. :)

Ariel_001
12-02-2004, 02:19 AM
Damn, I thought I was in software world !!!..