please help me get the system's time (with milliseconds) i need it to calculate the Soap request and response time in my SOAP project. i tried to use timer but the problem is, whenever i'm invoking a method.... the timer gets stuck along with the process, meaning it always returns .01 millisecond.... .. timer hangs with my pc..... i need to get the system time (with milliseconds) before and after calling the webservice then compute for the difference..... PLEASE HELP ME GUYS THIS THING'S IMPORTANT TO ME !! Thanx a lot !!!!!
8 44062
please help me get the system's time (with milliseconds) i need it to calculate the Soap request and response time in my SOAP project. i tried to use timer but the problem is, whenever i'm invoking a method.... the timer gets stuck along with the process, meaning it always returns .01 millisecond.... .. timer hangs with my pc..... i need to get the system time (with milliseconds) before and after calling the webservice then compute for the difference..... PLEASE HELP ME GUYS THIS THING'S IMPORTANT TO ME !! Thanx a lot !!!!!
use Format(Now, "HH:mm:ss:m s")
use Format(Now, "HH:mm:ss:m s")
sorry, the above post is worng
Solved....
'Declarations :
-----------------------------------------------------------------------------------------------------------
Option Explicit
Private Type SYSTEMTIME
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
Private Declare Sub GetSystemTime Lib "kernel32" _
(lpSystemTime As SYSTEMTIME)
------------------------------------------------------------------------------------------------------------
'Function :
------------------------------------------------------------------------------------------------------------
Public Function TimeToMilliseco nd() As String
Dim sAns As String
Dim typTime As SYSTEMTIME
On Error Resume Next
GetSystemTime typTime
sAns = Hour(Now) & ":" & Minute(Now) & ":" & Second(Now) & _
":" & typTime.wMillis econds
TimeToMilliseco nd = sAns
End Function
guess so.... but why? i mean it goes with vb's format function right? why will it be wrong???... hmm... can you test the code that i've posted? perhaps you can help me decide what's the correct one.... and please explain to me why your post is wrong. i tested it, it's obviously wrong but what made it wrong? thanx....
guess so.... but why? i mean it goes with vb's format function right? why will it be wrong???... hmm... can you test the code that i've posted? perhaps you can help me decide what's the correct one.... and please explain to me why your post is wrong. i tested it, it's obviously wrong but what made it wrong? thanx....
no, i told the post which i had post is wrong
use Format(Now, "HH:mm:ss:m s")
Format(Now, "HH:mm:ss:m s")
is incorrect..... for some reason the ms is not reconised by visual basic...
I've not had time to look into it, but do simple test - Private Sub Command1_Click()
-
MsgBox Format(Now, "HH:mm:ss:ms")
-
End Sub
you will see the last 3 digits are actully seconds.....
my is "3" then the current seconds digit(s)
the API GetSytemTime Works best for current system time.... API's are always preffered
Hope this is what you wanted: -
Public Sub DoWork()
-
Dim startDt as Date = Now()
-
-
' Do you work here
-
-
Dim endDt as Date = Now()
-
-
Dim tm as long = DateDiffMs(startDt, endDt)
-
-
End Sub
-
-
-
Public Shared Function DateDiffMs(ByVal startDt As Date, ByVal endDt As Date) As Long
-
Dim ms As Long = DateDiff(DateInterval.Second, startDt, endDt) * 1000
-
If (endDt.Millisecond - startDt.Millisecond) < 0 Then
-
ms += 1000 - (startDt.Millisecond - endDt.Millisecond)
-
Else
-
ms += (endDt.Millisecond - startDt.Millisecond)
-
End If
-
Return ms
-
End Function
-
Cheers!
Hope this is what you wanted: -
Public Sub DoWork()
-
Dim startDt as Date = Now()
-
' Do you work here
-
Dim endDt as Date = Now()
-
Dim tm as long = DateDiffMs(startDt, endDt)
-
End Sub
-
-
Public Shared Function DateDiffMs(ByVal startDt As Date, ByVal endDt As Date) As Long
-
Dim ms As Long = DateDiff(DateInterval.Second, startDt, endDt) * 1000
-
If (endDt.Millisecond - startDt.Millisecond) < 0 Then
-
ms += 1000 - (startDt.Millisecond - endDt.Millisecond)
-
Else
-
ms += (endDt.Millisecond - startDt.Millisecond)
-
End If
-
Return ms
-
End Function
-
This actually works. I have been looking for a solution to this sort of problem for some time. Funny that I never came across the "Date.Milliseco nd" bit, it was there all the time...
Thanks very much.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: curious |
last post by:
I am new to VB.NET and I need help in using timer control. Here is
the scenario. I have 3 labels (label 1, label2, label 3), and a start
button, all vertically aligned on the form.
Using a timer control with interval value of 3000, i.e 3 second, I
want to accomplish the following:
- Initially, only START button is visible to the user, i.e the 3
labels are set to be invisible.
- When click on START button, the button disappear and...
|
by: William Bub |
last post by:
Is there an accurate way to create a "stopwatch" good to 1/10 of a second?
I'm not sure if I should use the timer control, or some way to access the
computer timer. I found the following site
http://searchvb.techtarget.com/tip/1,289483,sid8_gci535495,00.html
which has the following:
> Want to really get down to instants? This tip from reader Phil Lenoir
tells you how.
>...
|
by: David |
last post by:
Hi There!
I'm using Timer control to record how long my application perform certain
tasks.
However, apparently Timer control is not doing its' job (i.e. Not firing
Tick event) while my application is busy. So even if my application took 2
mins, the label that is used to show the number of seconds elapsed will
still say "2 seconds".
|
by: Partho Choudhury |
last post by:
Hi all:
I need to add a snippet which access the system time (upto atleast
milliseconds) using ANSI std. C++. I cannot use MFC and Win32 APIs in
my program for now for various reasons. Is there something like this
in ANSI C++ which allows access up to milliseconds. I know that time.h
and CTime allow access up to the second level, but I need to work in
the msec level.
Any help will be appreciated.
|
by: marcus |
last post by:
Is their a method in c++ or c that gives me the system time in
milliseconds or higher resolution? I need it to be platform
independent. Today I use timeGetTime which is windows specific.
thanks
| |
by: Steve |
last post by:
I am working on a emulator and need to have time based events. I've tried
to use the timer control and discovered that it runs waaaaaaay slow. I set
the tick frequency to 1, then in the tick event I update a label on my form,
nothing else. just counting in my head I have determined that it take
roughly 14 seconds to get through 1000 ticks or 1 second of the timer.
This really surprises me. I haven't even done any processing yet and...
|
by: abhishek007p |
last post by:
HI,
i am using visual web developer for .net 2.0.
does .NET 2.0 comes with a timer control, i was unable to find it in
the IDE, where is it ?
thanks,
Abhishek
|
by: Steve |
last post by:
Hi All
I am using VB.net 2008 and use timer controls within my applications
Question
Does the code in a Timer control.tick event run on a different thread to the
main Application thread (UI Thread)?
In some of the timers I update some UI controls e.g statusbar.labels and I
|
by: neelsfer |
last post by:
I need to add milliseconds to this finishtime of race
!!! = Format(Now(), "General Date")
Start code for race also in milliseconds
!!! = Format(Now(), "General Date")
I will then subtract it from the start time and get a result in milliseconds
RacingTime: Format(-,"hh:nn:ss")
Any suggestions on how this can be accomplished?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| | |