Thursday, September 25, 2008

Metric Time

This entry is for people who want to take a look at the code and at the clock for metric time.


 


Code begins here:



// This line puts the date object into a variable we can use more easily
var now:Date = new Date();
// These 3 lines put the hours, minutes, and seconds into variables
var hours = now.getHours();
var minutes = now.getMinutes();
var seconds = now.getSeconds();
// Conditional that adds 0 to the front of any hour less than 10
if (hours < 10) {
hours_txt.text = "0" + hours;
} else {
hours_txt.text = hours;
}
// Conditional that adds 0 to the front of any minute less than 10
if (minutes < 10) {
minutes_txt.text = "0" + minutes;
} else {
minutes_txt.text = minutes;
}
// Conditional that adds 0 to the front of any second less than 10
if (seconds < 10) {
seconds_txt.text = "0" + seconds;
} else {
seconds_txt.text = seconds;
}
////////////////////////// THIS CODE IS FOR METRIC TIME /////////////
var metric:Date = new Date();
//This formula is to obtain the amount of seconds according to hours.
var metricHours = metric.getHours();
var metricMinutes = metric.getMinutes();
var metricSeconds = metric.getSeconds();
var metricMiliseconds = metric.getMilliseconds();
var convertedMiliseconds = (metricMiliseconds/1000)/0.864;
convertedMiliseconds_txt.text = convertedMiliseconds;

var secondsinhours = metricHours * 3600;
var secondsinminutes = metricMinutes * 60;
var secondsinseconds = metricSeconds;
var totalSeconds = secondsinhours + secondsinminutes + secondsinseconds;
totalSeconds_txt.text = totalSeconds;

//////Convert total seconds into Metric Seconds
var totalMetricSeconds = (totalSeconds / 0.864) + convertedMiliseconds;
totalMetricSeconds_txt.text = totalMetricSeconds;

///these are the variable for the metric clock hours
var clockmetricHours = totalMetricSeconds/10000;
clockmetricHours_txt.text = "0" + Math.floor(clockmetricHours);
//these are the variables for the metric clock minutes

var clockmetricMinutes = (totalMetricSeconds/100)-(Math.floor(clockmetricHours)*100);
if (clockmetricMinutes < 10) {
clockmetricMinutes_txt.text = "0" + Math.floor(clockmetricMinutes);
} else {
clockmetricMinutes_txt.text = clockmetricMinutes;
}
//these are variables for the metric clock seconds
var hourstosubstract = Math.floor(totalMetricSeconds/10000);
hourstosubstract_txt.text = hourstosubstract;
var minutestosubstract = Math.floor(((totalMetricSeconds - (hourstosubstract*10000))/100));
minutestosubstract_txt.text = minutestosubstract;
var clockmetricSeconds = Math.floor(totalMetricSeconds - (hourstosubstract*10000))-minutestosubstract*100;
if (clockmetricSeconds < 10) {
clockmetricSeconds_txt.text = "0" + clockmetricSeconds;
} else {

clockmetricSeconds_txt.text = clockmetricSeconds;
}

Code ends here.



5 comments:

Ray Lee John said...

Hi, I just discovered your youtube video. I wanted to say that I had the same idea about the same time as you as I was visiting friends in Berlin. I started a simple blog to explain my idea:

http://darocridecimalclock.blogspot.com/

(I called the clock a Darocri Clock since I worked out the idea with friends (David, Rodrigo, Cristina, thus DaRoCri). Rodrigo is a scientist and Cristina works at the Spanish embassy in Berlin.

If you read my blog you will see that I add an important concept that I haven't seen anywhere else yet: a new middle-length time concept to gap the awkwardness of such long hours. (I called it a "dessy.")

Also a young Swiss man came up with something similar and has made the news lately, but his clock seems to be using two 10-hour periods each day (I say "seems" because I have been told this but haven't read it yet). He has the luck to be the son and grandson of swiss watchmakers. His name is David Chanson and I will look for a link to send to you.

My name is David Hornback. I am an American but I live between Spain and Berlin.

I think that the only way we are going to get a metric day started is by associating with other like-minded people. my email address is : maxelectron@gmail.com

David

Ray Lee John said...

Johnny, here is one of the links to the Swiss guy's 10-hour watches. I still suspect that it is a twice daily 10 hours, and not a metric 10-hour-day, but I am not sure.

http://www.canberratimes.com.au/news/local/news/general/swiss-designers-logical-watch-is-ahead-of-its-time/1396204.aspx

David

Anonymous said...

herbal viagra free sample viagra viagra pharmacy viagra generic soft tab generic viagra india canadian viagra viagra rrp australia cost effects of viagra on women cheap viagra canada viagra soft tabs viva viagra song uk alternative viagra is viagra safe for women generic viagra india

Anonymous said...

Genial fill someone in on and this post helped me alot in my college assignement. Thank you on your information.

Anonymous said...

So cool! Thanks.