function,InternetTime,calculates,standard,fro
Quick Search for:  in language:    
function,InternetTime,calculates,standard,fro
   Code/Articles » |  Newest/Best » |  Community » |  Jobs » |  Other » |  Goto » | 
CategoriesSearch Newest CodeCoding ContestCode of the DayAsk A ProJobsUpload
RentACoder Stats

 Code:  lines
 Jobs: 0 postings

 
Sponsored by:

 

You are in:

 
Login



Latest Code Ticker for RentACoder.
Wrapping Scrolling Text
By Paranoid_Androi d on 7/2


Create A Dummy File
By AML on 7/2


Click here to see a screenshot of this code!Captionbar manipulation!
By Peter Hebels on 7/2

(Screen Shot)

A Game Of War
By Co0nest on 7/2


Click here to see a screenshot of this code!KeyGen Example
By Bengie|NET on 7/2

(Screen Shot)

Click here to see a screenshot of this code!OpenBrowser v1.9
By Orlando Jerez on 7/2

(Screen Shot)

SendMessageBySt ring() Example
By Jaime Muscatelli on 7/2


Click here to see a screenshot of this code!FirstSunday
By Jan Paul Penning on 7/2

(Screen Shot)

Click here to see a screenshot of this code!Ikonz v1.0
By Gaurav Creations on 7/2

(Screen Shot)

Click here to put this ticker on your site!


Add this ticker to your desktop!


Daily Code Email
To join the 'Code of the Day' Mailing List click here!





Affiliate Sites



 
 
   

Calculate InternetTime

Print
Email
 
VB icon
Submitted on: 6/19/1999
By: Hiu-Hong Hau  
Level: Not Given
User Rating: By 101 Users
Compatibility:

Users have accessed this code 8586 times.
 
 
     The function InternetTime() calculates the internettime, the new time standard from Swatch. You only have to call the function.
 

Windows API/Global Declarations:

Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!

    //**************************************
    //     
    //Windows API/Global Declarations for :C
    //     alculate InternetTime
    //**************************************
    //     
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    '*****************************************************************'
    '* The function InternetTime() returns the current time *'
    '* in beats. The code to determine the timezone has been written *'
    '* by Dror Saddan (drors@ietusa.com).*'
    '* The code to calculate the internettime has been written by*'
    '* Swatch. I have ported it to Visual Basic. *'
    '**'
    '* Written by Hiu-Hong Hau (hhhau@dds.nl)*'
    '* Date: June 20th 1999 *'
    '* Website: http://www.supervisie.nl/qlaunch *'
    '* Website: http://www.supervisie.nl/gemini *'
    '**'
    '* Take a look at QuickLaunch, a skinnable application launcher, *'
    '* completely written in Visual Basic.*'
    '*****************************************************************'
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    Public Type SYSTEMTIME ' 16 Bytes
    wYear As Integer
    wMonth As Integer
    wDayOfWeek As Integer
    wDay As Integer
    wHour As Integer
    wMinute As Integer
    wSecond As Integer
    wMilliseconds As Integer
    End Type
    Public Type TIME_ZONE_INFORMATION
    Bias As Long
    StandardName(31) As Integer
    StandardDate As SYSTEMTIME
    StandardBias As Long
    DaylightName(31) As Integer
    DaylightDate As SYSTEMTIME
    DaylightBias As Long
    End Type
    Public Declare Function GetTimeZoneInformation Lib "kernel32" (lpTimeZoneInformation _
    As TIME_ZONE_INFORMATION) As Long
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 
Terms of Agreement:   
By using this code, you agree to the following terms...   
1) You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for langauges that allow it) freely and with no charge.   
2) You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
3) You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
4) You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.

    //**************************************
    //     
    // Name: Calculate InternetTime
    // Description:The function InternetTime
    //     () calculates the internettime, the new 
    //     time standard from Swatch. You only have
    //     to call the function.
    // By: Hiu-Hong Hau
    //
    // Returns:This function returns a value
    //     containing the internettime. If you want
    //     to convert it to a small string, you cou
    //     ld use the following: Mid(Format(MyTime,
    //     "000.0000000"), 1, 3)
    //
    // Assumes:Copy and Paste all of these c
    //     ode in one single module.
    //
    //This code is copyrighted and has    // limited warranties.Please see http://
    //     www.Planet-Source-Code.com/xq/ASP/txtCod
    //     eId.2131/lngWId.-10/qx/vb/scripts/ShowCo
    //     de.htm    //for details.    //**************************************
    //     
    
    Public Function GetTimeZone(Optional ByRef strTZName As String) As Long
    Dim objTimeZone As TIME_ZONE_INFORMATION
    Dim lngResult As Long
    Dim i As Long
    lngResult = GetTimeZoneInformation&(objTimeZone)
    Select Case lngResult
    Case 0&, 1& 'use standard time
    GetTimeZone = -(objTimeZone.Bias + objTimeZone.StandardBias) 'into minutes
    For i = 0 To 31
    If objTimeZone.StandardName(i) = 0 Then Exit For
    strTZName = strTZName & Chr(objTimeZone.StandardName(i))
    Next
    Case 2& 'use daylight savings time
    GetTimeZone = -(objTimeZone.Bias + objTimeZone.DaylightBias) 'into minutes
    For i = 0 To 31
    If objTimeZone.DaylightName(i) = 0 Then Exit For
    strTZName = strTZName & Chr(objTimeZone.DaylightName(i))
    Next
    End Select
    End Function
    Public Function InternetTime()
    Dim tmpH
    Dim tmpS
    Dim tmpM
    Dim itime
    Dim tmpZ
    Dim testtemp As String
    tmpH = Hour(Time)
    tmpM = Minute(Time)
    tmpS = Second(Time)
    tmpZ = GetTimeZone
    itime = ((tmpH * 3600 + ((tmpM - tmpZ + 60) * 60) + tmpS) * 1000 / 86400)
    If itime > 1000 Then
    itime = itime - 1000
    ElseIf itime < 0 Then
    itime = itime + 1000
    End If
    InternetTime = itime
    End Function

 
Report Bad Submission
Use this form to notify us if this entry should be deleted (i.e contains no code, is a virus, etc.).
Reason:
 
Your Vote!

What do you think of this code(in the Not Given category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor See Voting Log
 
Other User Comments
6/20/1999 6:54:00 AM:cydonia76
This code is stuffed. Yeah, it sounds 
good
but what the hell does it do? If 
somebody 
can make use of this code, 
then i would like to know how!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
6/20/1999 7:05:00 AM:H.H.Hau
What does it do? Well, it calculates 
the internettime. It may not be of much 
use for you, but others may incorporate 
this code in their own clock or 
something. You can goto 
http://www.swatch.com/internettime/fs_ti
me.html for an explanation of what 
internettime is.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
6/20/1999 9:51:00 AM:James
I tried out your code, and checked 
it
against the converter on the swatch 
site.
Your code doesn't seem to be 
calculating
time zones correctly, as 
I'm getting an
Internet time 3 hours 
ahead of what it should
be.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
6/20/1999 12:35:00 PM:H.H.Hau
That's odd! I've changed different 
computers here to different timezones 
and it worked for me... Really odd. I 
also tested on DayLight savings, also 
succesfull. What timezone are you in?
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
6/20/1999 1:28:00 PM:Robb
Worked great for me even the time zone 
worked fine.  I think I'll keep the 
code around just in case this Internet 
time catch's on, along with the one 
world order :)
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
6/21/1999 10:59:00 AM:James
Possibly I am doing something wrong 
then.
Do I put the two functions into 
the module,
or into the code for my 
form?
And what would be the correct 
way to call
the function?
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
6/21/1999 12:55:00 PM:H.H.Hau
Put all the code in one single module. 
Make on your form a button and a label 
and onclick event for the button e.g. 
label1.caption=InternetTime()
that 
should work.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
7/2/1999 9:03:00 PM:chris
can somebody teach me how to do a 
calculator
on calculate time rate :)
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
7/7/1999 12:01:00 PM:mikeg
"InternetTime" is about the dumbest 
idea I've heard in a long time. Years 
and years ago GMT (Greenwich Mean Time) 
was established as the 'universal time' 
(GMT is the same as "CUT" or 
Coordinated Universal Time, also known 
as "UCT"). GMT (or UCT) is the same no 
matter where you are in the universe. I 
can't believe Swatch has complicated 
our lives by introducing a new time 
standard. (In the USA) call (303) 
499-7111 to hear the NIST atomic clock 
in Colorado tell you what time it 
REALLY is. There's also a web site at 
http://hpv17.infosys.tuwien.ac.at/AtomZe
it/HowsTheTime.pl that displays UCT 
according to an atomic clock at the 
Vienna University of Technology. 
I 
hope people don't take Swatch 
seriously! It's totally regressive to 
consider using some other "mean time".
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
7/9/1999 4:45:00 AM:Andy
mikeg : if you dont like this, you're 
going to love the french :)
A few 
weeks ago they decided to abandon 
GMT/UCT/CUT and make their own meridian 
running through paris. Now thats just 
silly.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
7/9/1999 4:47:00 AM:Andy
Great code by the way :)
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
7/14/1999 4:38:00 PM:jdallen
Mikeg.    This site is for expression 
of ideas in the programming world.   
Why not take Swatch seriously, the 
world is do for a change cuz its 
starting to get doaring.    Just think, 
how many people do you really think 
call for the time any ways. I don't, 
its a wast of time. Why not make it so 
all you have to do is "one click for 
time, two clicks for temp." :-)
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
7/14/1999 4:40:00 PM:jdallen
Greate code. 
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
7/15/1999 3:47:00 AM:H.H.Hau
Thanx, at least somebody is happy with 
my code! :P
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
7/15/1999 11:29:00 AM:roberto
I really is a good program; however, I 
would suggets to add something more 
productive such as location visited 
and time spent on them
otherwise 
congratulations !!!!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
7/26/1999 7:38:00 AM:bob
I tryed the code and i get error on the 
line :
strTZName = strTZName & 
Chr(objTimeZone.DaylightName(i))
The 
error is :
"Run-time error '5': 
Invalid procedure call or 
argument"
can someone help me?
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
7/28/1999 9:17:00 PM:toto
please help me , i have database in sql 
server and then in visual basic i use 
ADO so how can i save or addnew data in 
vb with ADO
thanks
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
7/28/1999 9:19:00 PM:toto
hallo 
test 
test 
test
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
7/31/1999 4:02:00 PM:Flaperman
I cannot make use of this code, and i 
also think that it is a rotten 
code...
Flaperman, Denmark
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
8/2/1999 12:57:00 PM:Flash
Hi,
the code worked fine for me 
but...
In what format does it display 
the time????
I get 992.4652777777 when 
I was conected 1:08 hours....
Can 
you please explain me?
Thanks 
You
Flash
ICQ 3233432
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
8/12/1999 12:13:00 PM:Dexter
Honestly I have to say I haven't tried 
your code yet but it browsed my 
interest because I was wondering how 
can I get the time in 
milliseconds?
I was thinking maybe 
with "TimeGetSystem" but I haven't had 
any success finding any good examples 
of it.  I would appreciate it if you 
could point me in the right 
direction.
Thanks,
Dexter 
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
8/28/1999 7:51:00 AM:jagdish
this seems to be intresting and useful 
but my needs are a bit different 
i 
avtually want to find how much time i 
am connected on to net. i am actually 
launching the application 
after which 
i want to fine this application is of 
some third party user but once it 
starts the net i want to find the tiem 
.
will this be useful please help and 
plese mail back on how to do.
thanx 
in advance 
jagdish
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
9/15/1999 2:27:00 AM:Sudkhet Thepphornphitak
Please message to me
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
9/17/1999 8:34:00 AM:Chris
>the code worked fine for me 
but...
>In what format does it display 
the 
>time????
>I get 992.4652777777 
when I was conected 1:08 
hours....
The "Internet Time" has 
nothing to do with the time you have 
been connected to the internet. It is a 
new invention by
Swatch, Switzerland 
which does basically the same as 
GMT/universal time: a method to compare 
the time worldwide.
The day is 
divided into 1000 intervals (one equals 
about 1 min 26 sec),
so I was almost 
"midnight" when your computer said it 
was "992".
According to Swatch, the 
Internet Time is supposed to be 
useful
for "chatters", because people 
can meet at a certain "internet 
time",
which is the same on the whole 
planet, online.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
9/17/1999 3:10:00 PM:vb-boy
please send this source in a zip to 
koffe1@hotmail.com
PLEASE!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
10/22/1999 1:05:00 AM:TM Daemon
Nice idea!!!
I can actually use this 
to set all my workstation times to my 
Unix server!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/17/1999 9:16:00 PM:sung
anybody know how to this code..
if you 
got completed code,
please send me 
!
basic@altavista.co.kr
have nice a 
day ;-)
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
12/5/1999 2:42:00 PM:Oliver T
You mustn't only write the function for 
displaying it all correct! You hvae to 
wirte object.caption =              
(CInt(Internettime))  !
CU 
OLIVER
See my programs @ 
planet-source-code!!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/7/2000 12:52:16 AM:Rob Wise
code works fine for me and it quite 
impressive coding, very useful if this 
internet time ever catches on.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/2/2002 2:39:43 PM:Duy Nguyen
Please tell me how to use this code
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/2/2002 3:35:02 PM:Duy Nguyen
Please tell me how to use this code 
please. Softw4re@Yahoo.Com Thank YOu
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
Add Your Feedback!
Note:Not only will your feedback be posted, but an email will be sent to the code's author in your name.

NOTICE: The author of this code has been kind enough to share it with you.  If you have a criticism, please state it politely or it will be deleted.

For feedback not related to this particular code, please click here.
 
Name:
Comment:

 

Categories | Articles and Tutorials | Advanced Search | Recommended Reading | Upload | Newest Code | Code of the Month | Code of the Day | All Time Hall of Fame | Coding Contest | Search for a job | Post a Job | Ask a Pro Discussion Forum | Live Chat | Feedback | Customize | RentACoder Home | Site Home | Other Sites | About the Site | Feedback | Link to the Site | Awards | Advertising | Privacy

Copyright© 1997 by Exhedra Solutions, Inc. All Rights Reserved.  By using this site you agree to its Terms and Conditions.  Planet Source Code (tm) and the phrase "Dream It. Code It" (tm) are trademarks of Exhedra Solutions, Inc.