I have a code that pulls a JSON response, and I need to compare times from now() and a previous when the timestamp was created. I am able to pull the info and have it display. However, when i try and get the comparison to work it just sits there and doesnt display anything. Here is my code "use strict"; var endDate = new Date(); endDate.setHours(endDate.getHours()); var startDate = new Date(); startDate.setHours(- 12); api.call("Get", { "typeName": "DutyStatusLog", "search": { "fromDate" : startDate, "ToDate" : endDate, "statuses" :['ON'] } }, function(results){ console.log(results); for(var i=0; i<results.length; i++){ var stTime = results[i].dateTime; var …

Member Avatar
Member Avatar
+0 forum 1

I run a website where I periodically post articles. I'd like to add a timestamp/datestamp to each article showing the post date (the upload date, I assume, would be the logical choice). I had already asked for advice on this topic; unfortunately, the result is a blank. Literally. Here's an example: http://theapplenewsreel.com/Example.php After the title and subtitle, there's some small (<h6>) text, which should be followed by the PHP code which displays a timestamp. I'm new to PHP, so I may be doing something wrong. Any advice?

Member Avatar
Member Avatar
+0 forum 9

Hello, I am running a software on a Linux machine, I am synchronizing time via default ntpd configurations available in Linux (/etc/ntp.conf). I am connecting to the customer NTP server. Now i was requested to tell which synchronization type is used on my machine (Frequency Synchronization/ Time Synchronization or Time-of-day Synchronization) Now after some googling it seems there is two types for NTP synchronization: 1- Phase Synchronization. 2- Frequency Synchronization. But how can I decide which of them is used by Linux? I am already connected the customer NTP server and they told that their NTP doesn't support Time Synchronization, …

Member Avatar
Member Avatar
+0 forum 4

I am using an Arduino to prototype a project in which the real time is important. My device has a real time clock and internet access. I have some NTP code I can use to get the current time in GMT and I can apply an offset for the timezone the device is in, so I can set the RTC accurately enough. What I am unclear about is whether summer time applies. How can I know that from within my code?

Member Avatar
Member Avatar
+0 forum 2

I am writing a game in which I need to know whether or not a user preforms an action in one second or less. I can not use time() because it measures time in seconds. If the user starts the action half-way through a second it would mess with accuracy. I am experimenting with clock(). I have got clock to work with some programs to make a delay, but not in this way to measure time: [CODE] #include <iostream> #include <ctime> using namespace std; int main() { clock_t start = clock(); cout << "press enter..."; cin.ignore(); clock_t finish = clock(); …

Member Avatar
Member Avatar
+0 forum 12

i have created a recursive method that returns the size of a binary search tree, i would like to analyze the running time of my implementation but i dont know how. I know the best case is O(1) if node is null but what about worst case? my researches online offer conflicting information. One source says to imagine the internal stack which makes me believe O(N^2) and another says to break it up into an equation. I feel like the worst case is O(N) as each of the nodes must be accessed in order to return their value but i …

Member Avatar
Member Avatar
+0 forum 8

it says the following: Write a function that converts the time to 24hr format. Examples [CODE] >>> time24hr('12:34am') '0034hr' >>> time24hr('12:15pm') '1215hr' [/CODE] so i wrote the following: [CODE] def time24hr(tstr): a = tstr.split(':') am = {'12':'00','1':'01','2':'02','3':'03','4':'04','5':'05','6':'06', '7':'07','8':'08','9':'09','10':'10','11':'11'} pm = {'12':'12','1':'13','2':'14','3':'15','4':'16','5':'17','6':'18', '7':'19','8':'20','9':'21','10':'22','11':'23'} if 'am' in tstr: return am[a[0]] + a[1][:2] + 'hr' elif 'pm' in tstr: return pm[a[0]] + a[1][:2] + 'hr' [/CODE] But what would have been a better way to do it? i imagine their is an inbuilt method of doing this, but is there a more efficient way to do this without inbuilts? and could you show …

Member Avatar
Member Avatar
+0 forum 5

This snippet defines a function returning new identifiers created from reading the computer's time.

Member Avatar
Member Avatar
+0 forum 5

I need to make some KML code that is basically a coloured track. So far I have worked out that it either has to be lots of small lines or placemarks. However usually with this there is no way to use the time bar. Is there a way to be able to have lots of small lines/placemarks that are affected by the timebar. Thank you.

Member Avatar
Member Avatar
+0 forum 1

im looking for way to make my game allow players to play with each others via internet i can use some kind of rooms i need help to know what is the recommended engines that can i use for real time multiplayer apps

Member Avatar
+0 forum 0

This is just for fun. You know how old you are(I hope), but do you know how many days you are walking around on this planet? The two routines presented here could be used more practically in an ever present employee application.

Member Avatar
Member Avatar
+0 forum 4

Hello, i was wondering if i could get an opinion on the following code as it is giving me a headache: int counter = 498853097; int k = 0; clock_t start, end; float seconds1,seconds2; start = clock(); for (int i = 0; i < counter; i++) { k++; } end = clock(); seconds2 = (float)(end - start) / CLOCKS_PER_SEC; start = clock(); for (int i = 0; i < counter; i++); end = clock(); seconds1 = (float)(end - start) / CLOCKS_PER_SEC; printf("\n Time 2 [%f] - Time 1 [%f] = %f",seconds2,seconds1,seconds2-seconds1); It's the exact same repetition twice, except one of …

Member Avatar
Member Avatar
+0 forum 2

Hi friends. With `datetime.datetime.now()` or `datetime.datetime.today()` i can get the current date (English calendar) for my program but what about if i want to get the current date (from Persian calendar) for my program; then what should i do? As my pc os date is set to English calendar so what can i do?

Member Avatar
Member Avatar
+0 forum 2

Hello friends. I want to create a countdown program for the new year that is comming. I know i can use this code for example, for short certain time: from threading import Timer def sayhi(): print "hello everybody!" t = Timer(10, sayhi) t.start() But the new year begins in 29 days (2015, march 21)(at 02:15:11 AM). So i cant calculate how many seconds is left!! So what can i do? I think i should give the date to the program and it should use a calendar maybe, but i don't know how.

Member Avatar
Member Avatar
+0 forum 13

I'm studying for a test and appreciate your help. How to calculate the running time (T(n)) of the following segment (written in Pascal): k := 0; m := n; while m <= n do begin k := k + 1; m := k * k; end; for i := 1 to k do for j := i to k do begin s := s + m; m := m - 1; end;

Member Avatar
Member Avatar
+0 forum 1

I want to copy all the files from one directory to another using the fread() and fwrite()-statements. Some of these files are rather large in size, and that's why I want to calculate who long the transfer will take. (Later I will use this information to show a progress bar containing remaining transfer time, percent data transferred so far and (possibly) the actual transfer speed). **The problem is:** When I try to do a full transfer of the biggest file in the list (the one with index 0 in the fdata-struct) I find that the transfer time is much higher …

Member Avatar
Member Avatar
+0 forum 2

Dear all, I have created a code for QuicSort algorithm with random numbers and time executation but now I want to do for Countin sort And I don't know, Can anybady help me based in this example. Thanks include <iostream> include <conio.h> include <time.h> include <stdlib.h> //srand and rand functions using namespace std; void add_random_numbers ( long arr[], long b ); void QuickSort( long vektori[], long left, long right); long const MADH_MAX_VEKTORIT = 110000; int main() { long random_vector[MADH_MAX_VEKTORIT]; long vector[] = {1000, 10000, 15000, 25000, 30000, 45000, 50000, 60000, 75000, 90000, 100000}; long num_elem; clock_t tn, tp; srand( time( …

Member Avatar
Member Avatar
+0 forum 3

I want to make this code with random numebr array and time executation? Does anybady nows how can I do? #include <iostream> using namespace std; void print(int a[], int sz) { for (int i = 0; i < sz; i++ ) cout << a[i] << " "; cout << endl; } void CountingSort(int arr[], int sz) { int i, j, k; int idx = 0; int min, max; min = max = arr[0]; for(i = 1; i < sz; i++) { min = (arr[i] < min) ? arr[i] : min; max = (arr[i] > max) ? arr[i] : max; } …

Member Avatar
Member Avatar
+0 forum 1

i created a mailing option,when retriving messages it's taking lot of time and showing error of time delay.......can someone help??

Member Avatar
Member Avatar
+0 forum 1

With the advent of Python33 the module time has received a high resolution timer/counter. Here we use time.perf_counter() in a decorator to conveniently time two test functions.

Member Avatar
+3 forum 0

Hello Daniweb, So, I am currently working on a simple download time estimator program using JOptionPane and some loops. I have some beginning code and wanted to check how it is working, only it seems I messed up something and am stuck in my loop when I run it. I will keep working at what I am missing. Here is my code... package downloadTimeApp; /* * This program allows user input to find approximate download time. * by my name * date: 9/14/14 */ import javax.swing.JOptionPane; public class DownloadTimeApp { public static void main(String[] args) { // display operational messages …

Member Avatar
Member Avatar
+0 forum 3

i have this error "input string not in correct format"

Member Avatar
Member Avatar
+0 forum 2

so i have a page where i want a 2 second image intro then for the image to fade to the acutal page. maybe some sort of table that has a onload that after 2 seconds fades into the actual page? i could not figure it out.

Member Avatar
Member Avatar
+0 forum 1

I need to insert a cobobox value ,date value into database but am not sure if this is the method...i keep getting an exception saying 'Incorrect syntax near '@Numberpassengers'.' private void button1_Click(object sender, EventArgs e) { string c = ""; string s = ""; string d = ""; string t = ""; if (CarNameCombo.SelectedIndex >= 0 && SourceCombo.SelectedIndex>=0 && DestinationCombo.SelectedIndex>=0&&comboBox7.SelectedIndex>=0) c = CarNameCombo.Items[CarNameCombo.SelectedIndex].ToString(); s = SourceCombo.Items[SourceCombo.SelectedIndex].ToString(); d = SourceCombo.Items[DestinationCombo.SelectedIndex].ToString(); t = comboBox7.Items[comboBox7.SelectedIndex].ToString(); string date=dateTimePicker1.Text; string date1=dateTimePicker2.Text; SqlConnection conn = new SqlConnection("Data Source=PRAVEEN\\SQLEXPRESS;Initial Catalog=travelbooking;Integrated Security=True"); SqlCommand cmd = new SqlCommand("insert into BookDetails(CarName,Source,Destination,Date,FromAddress,ToAddress,Time,Numberpassengers)VALUES(@CarName,@Source,@Destination,@Date,@FromAddress,@ToAddress,@Time,@Numberpassengers"); cmd.CommandType = CommandType.Text; cmd.Connection = conn; cmd.Parameters.AddWithValue("@CarName", c); cmd.Parameters.AddWithValue("@Source", …

Member Avatar
Member Avatar
+0 forum 17

Hi guys. i have an event page that displays events from database. in my database I have a column with datetime format. is there a way to only get the date or time separate from each other in a select to be displayed? php: <?php require "connection.php"; $sessid = $_SESSION['sess_user_id']; $check = $dbh->prepare("SELECT * FROM event WHERE euser_id = $sessid ORDER BY start_event ASC "); $check->execute(array('euser_id')); if($check->rowCount() > 0) { $check->setFetchMode(PDO::FETCH_ASSOC); while($row = $check->fetch()) { $dstart = $row['start_event']; echo "<tr> <td>$dstart</td> </tr>"; } } ?> so right now in the database column start_event its like : 2014-08-09 13:30:00:00000 and what …

Member Avatar
Member Avatar
+0 forum 2

I'm trying to set a time limit of like 2 mins after time of a click event. How can I achieve this? Most of the countdown timers I see all over the internet are countdowns to dates like Aug 23, 2015

Member Avatar
Member Avatar
+0 forum 2

I found this site http://www.guyrutenberg.com/2007/09/22/profiling-code-using-clock_gettime/ If I have a server-client code and this: clock_gettime(CLOCK_REALTIME, &time_a); // create socket clock_gettime(CLOCK_REALTIME, &time_b); // close socket If I have a and b wand want to measure the time it takes to communicate, what's the best way ? Still not fully understanding the exact difference between CLOCK_REALTIME CLOCK_PROCESS_CPUTIME_ID CLOCK_THREAD_CPUTIME_ID And there are a few others.

Member Avatar
Member Avatar
+0 forum 3

Hi, I need to implement list based on dynamic arrays (second task is to implement as double linked list). Both tasks are done, but I have problem with time limit on test platform when values are millionths. I suppose that resizing dynamic array is delaying so much. I have implemented common list methods as push_front(), pop_back() ... For example: void push_front(int x) { size++; int* tab_temp = new int[size]; memcpy(tab_temp + 1, tab, (size - 1) * sizeof(int)); tab_temp[0] = x; delete [] tab; tab = tab_temp; } I thought about change resizing step from 1 to 10, but I …

Member Avatar
Member Avatar
+0 forum 5

So decided I should switch to VS13 for the added benefits. Copied the cold, transfered the files, alls good right? Wrong. Actually its not that bad. Just one main problem. `ltm` See this fella? This is the one guy that is standing in the way of me and the debachury that i am programing. He is the name of my pointer for the time aspect of my program. so... `ltm->tm_mon;` He and his buddies are throughout my 500+ line program that functioned fine in Bloodshed. The problem? VS13 doesnt play friendly with localtime (they dated once and had a fall …

Member Avatar
Member Avatar
+0 forum 1

Hey you all I got a time calculation question. I'm attempting to do a lot of PHP and AJAX code appending to HTML. I want to know if my code below will accurately calculate the time of entire code being executed or solely just the PHP code. If it just calculates the PHP, what other code can I add to give me an accurate length of time it takes for the code to execute. <?php $before = microtime(true); /* A bunch of PHP Code */ ?> <!DOCTYPE html> <script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"></script> <script type="text/javascript" src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> <script> $(function () { /* A …

Member Avatar
Member Avatar
+0 forum 2

The End.