problem with counting seconds

I found this function

SELECT

TRUNC (86400 *(date_to-date_from))-60 * (trunc ((86400 *(date_to-date_from)) / 60));
TRUNC ((86400 *(date_to-date_from)) / 60)-60 * (trunc (((86400 *(date_to-date_from)) / 60) / 60));
TRUNC (((86400 *(date_to-date_from)) / 60) / 60)-24 * (trunc (((86400 *(date_to-date_from)) / 60) / 60) / 24)),
TRUNC (((86400 *(date_to-date_from)) / 60) / 60) / 24)

IN tempsSec, tempsMin, timeHr, heureDAY

FROM DUAL;

Nice and easy compare two dates and return the (time) difference as 13 hours, 40 minutes, 10seconds

now, my system shows delays like this from 10:00 to 10:19 (which is the duration of 9 seconds if you use the function above).
now, what I tried to do is to add 1 second of time, since there are between 10:00 and 10:19 actuially 10 seconds elaps (0 to 1 (1 second), 1-2 (1 second)...)

so I tried to just add a seconds before the date_to

SELECT date_to + 1/24/60/60 INTO date_to FROM DUAL; -Add a second because 00 09 is 10 seconds of display time (not 9!)

but sometimes, this provides a valid information, sometimes when counting only seconds each presents a wrong time, so there is an obvious mistake, I do somewhere...

Rather than trying to debug the code you posted, it is probably easier to convert dates to timestamp, subtract the timestamps whiich returns an interval and extract the components of the interval.

Note that I add 1 second in the inline query. For the subtraction normal timestamp, you who would remove.

SQL> ed
Wrote file afiedt.buf

  1  with x as (
  2    select to_date( '10/24/2009 10:05:10',
  3                    'MM/DD/YYYY HH24:MI:SS' ) date_from,
  4           to_date( '10/24/2009 14:55:19',
  5                    'MM/DD/YYYY HH24:MI:SS' ) date_to
  6      from dual
  7    union all
  8    select to_date( '10/24/2009 10:05:10',
  9                    'MM/DD/YYYY HH24:MI:SS' ) date_from,
 10           to_date( '10/24/2009 10:05:29',
 11                    'MM/DD/YYYY HH24:MI:SS' ) date_to
 12      from dual
 13  )
 14  SELECT extract( day    from interval ) days,
 15         extract( hour   from interval ) hours,
 16         extract( minute from interval ) mins,
 17         extract( second from interval ) secs
 18    from (
 19  SELECT  to_timestamp(to_char(date_to,'MM/DD/YYYY HH24:MI:SS'),
 20                       'MM/DD/YYYY HH24:MI:SS')
 21          + interval '1' second
 22          - to_timestamp(to_char(date_from,'MM/DD/YYYY HH24:MI:SS'),
 23                       'MM/DD/YYYY HH24:MI:SS') interval
 24  FROM x
 25* )
SQL> /

      DAYS      HOURS       MINS       SECS
---------- ---------- ---------- ----------
         0          4         50         10
         0          0          0         20

Justin

Tags: Database

Similar Questions

  • Problems with counter on 9411

    I am a new user of Labview, so it's a little intimidating. I am using a cDAQ-9188 with several modules but I have problems with one is the 9411 is used to measure the speed off the coast of a torque meter.

    I joined the program I put in place. What I want to do is to measure the number of edges on a 3 second interval so that I can divide by the number of pulses/turn * 60 * 1/3 to receive the RPM. However, the number of edges behave linearly as I expected. I measured the speed of the shaft with a light strobe and represented graphically it vs the number of edges. The results are attached to the excel file.

    What Miss me? The number of edges should not increase as speed up the tree, or I'm going about this all wrong and is not what I think I am?

    Thanks in advance.

    Ahh ok, that make more sense - it seemed like a strange to report a couple measured, way but now I understand that your torque sensor also rpm through this collection of speed option and that's what you ask the subject (I can't see not how pulses/turn the sensor is on the site Web of Honeywell however, do you know offhand?).

    The software timing 3 seconds will implement much of the variability in your measure but would not explain the strong negative correlation between the RPM and the speed sensor (we're talking several ms of non-determinisme for a second window 3) output frequency.  Finally, you'll want to solve this problem as well, but it is not your problem right now (as an aside - it would be actually more accurate to measure the frequency of the signal encoder using the 80 MHz as a reference time base and average the result on a second window 3, the general idea is sort explained in manual of 9188 here but I digress).

    I think it is more likely that the signal from the speed sensor is a bit noisy (pretty typical of optical encoders) and then transitions the 9411 is picking up multiple edges.  A slower RPM equals longer transitions and therefore more false edges.  It is just a hunch, but that's what I can think of on the top of my head that could be causing what you see (if read number of pulses is higher than what you expect, given the pulses/turn of the sensor through all ranges of RPM that it would support my theory).  If you want to ignore the method of measurement for a second and try to solve the problem of noise (assuming there is one), you can add the following property node to your existing code before you begin the task:

    You can start by setting MinPulseWidth to 6.4us (which is one of the built-in clock dividers available for PFI filters on the 9188).  You want the MinPulseWidth be short enough to ensure detection of a legitimate impulse, but long enough to block all wrong edges that occur during transitions.

    Best regards

  • Problem with Counter strike 1.6 on Vista

    When I run my CS on vista, suddenly an unrecoverable error message on the screen that says "the available memory is less than 15MG!:-some figures.
    What should I do?

    Hi KiwiSwat,
     
    Please use the Forum of responses of Microsoft Windows Vista.
     
    It seems that this problem with CS has been resolved by running it in Windows Xp compatiability mode.
     
    Right-click on the shortcut, choose Properties, compatibility, mark the run this program in
    compatibility mode for: choose Windows XP SP2.
     
    You can also check the below CS forum that talks about the same mistake and was fixed by
    Try the above steps
     
    http://forums.counter-strike.com/counter-strike-1-6/7601-error-available-memory-less-than-15-MB.html
     
    Please let us know if that helps.

    --------------------------------------------------------------------------------
    Nicolas Mathieu
    Microsoft Answers Support Engineer

  • Connection problem with the second monitor, macbook pro 2014, OSX El Capitan

    There are a few threads describing problems with two monitors, but I have not found a match.

    I like for the operating system ask login password once the lid is closed, no matter how much time has passed (even for a moment). Also, I work with a dual monitor. However, when my macbook is plugged into the monitor and I close the lid, the macbook don't disconnect but spends just primary monitors. Understand that this could be a feature and not a bug, I tried to unplug the monitor before closing the lid. But the OS seems not to realize that the monitor has been disconnected, and when I close the lid he didn't ask me for my password once that I reopen it. Does it also if I wait a bit (i.e. one minute) after disconnecting the monitor, but not if I wait a while (or 15 minutes), well that I've not enough highlighted how long is necessary so that it starts locking on my closing the lid. He does it with different monitors, so I doubt that it depends on the particular monitor. In both cases, I used the HDMI port.

    This is quite annoying, because I need to be able to disconnect safely in a short period of time, and I was not able to find a workaround on mine. Everyone knows this? Thank you for any help or advice.

    Emilio

    You might have invoked indevrtantly this obscure 'functionality' of MacOS. Read the article and see if you do these things:

    Use your Mac laptop to view closed with an external display - Apple Support

    .

  • Problem with counting function, passing VARs between functions.

    Hi guys, I have a problem with this section of code...

    Could anyone suggest how to fix the function at the bottom so that when the button forward_btn with label "go to next Point training" when you click on recalculate the fields created in the function fileLoaded

    var xmlData:XML = new XML ();
    var theURL_ur:URLRequest = new URLRequest ("xml.xml");
    var loader_ul:URLLoader = new URLLoader (theURL_ur);
    var more: RegExp = / \ + / g;
    var t:Number = 0;
    var tmax:Number = 0;

    loader_ul.addEventListener ("complete", fileLoaded);

    function fileLoaded(e:Event):void {}
    xmlData = XML (loader_ul.data);
    Tmax = xmlData.Record.length ();
    trace (tmax);

    trace (unescape (xmlData));
    trace (xmlData.Record.length ());


    var title_tp:String = unescape(xmlData.Record.TP.Title[t]).replace (, "");
    Title_TP_txt. Text = title_tp;

    var intro_tp:String = unescape(xmlData.Record.TP.Introduction[t]).replace (, "");
    Intro_TP_txt. Text = intro_tp;

    static_tp_intro.y = Title_TP_txt.y + Title_TP_txt.textHeight + 10;
    Intro_TP_txt.y = sta_tp_intro.y + sta_tp_intro.textHeight + 5;

    Title_TP_txt. AutoSize = TextFieldAutoSize.LEFT;
    Intro_TP_txt. AutoSize = TextFieldAutoSize.LEFT;
    }

    forward_btn.label = "go to the next Point training";
    forward_btn.addEventListener (MouseEvent.CLICK, next_if);

    function next_if (me: MouseEvent): void {}


    If (t == tmax) {play();  }


    else {t = t + 1;
    fileLoaded () ;}
    }

    I don't see where you have a question from vars between functions because you do not pass everything.  Maybe that's your problem.  The function fileLoaded expects an argument, but you are not providing one.  To get around that you should provide any argument being sent in the first function...

    function fileLoaded(e:Event=null):void {}

    Another option would be to separate features and put a quick end to the function fileLoaded and create another function that holds the rest of the code...

    function fileLoaded(e:Event):void {}
    xmlData = XML (loader_ul.data);
    Tmax = xmlData.Record.length ();

    processXMLData();

    }

    function processXMLData (): void {}
    trace (tmax);

    trace (unescape (xmlData));
    trace (xmlData.Record.length ());

    var title_tp:String = unescape(xmlData.Record.TP.Title[t]).replace (, "");
    Title_TP_txt. Text = title_tp;

    var intro_tp:String = unescape(xmlData.Record.TP.Introduction[t]).replace (, "");
    Intro_TP_txt. Text = intro_tp;
      
    static_tp_intro.y = Title_TP_txt.y + Title_TP_txt.textHeight + 10;
    Intro_TP_txt.y = sta_tp_intro.y + sta_tp_intro.textHeight + 5;
      
    Title_TP_txt. AutoSize = TextFieldAutoSize.LEFT;
    Intro_TP_txt. AutoSize = TextFieldAutoSize.LEFT;
    }

    forward_btn.label = "go to the next Point training";
    forward_btn.addEventListener (MouseEvent.CLICK, next_if);

    function next_if (me: MouseEvent): void {}

    If (t == tmax) {}

    Play();

    } else {}

    t = t + 1;
    processXMLData();

    }
    }

  • El Capitan v10.11.5 - problems with the second user

    Just installed 10.11.5.  I am able to log in under the master user, but when I try to log on to the second user, she just the turning wheel under the name after entering the password.  Any ideas of what I should do?  I'm not trying to delete and start again there are programs, files, etc. that are on this profile.  Thank you!

    The first time, it connects after an upgrade of the system always takes a relatively long time (maybe a minute or two) that various pieces of household necessity to do.

    If it's every time, however, you may have gotten a 'connection point' for the second user who is not compatible with 10.11.5.

    Restart in 'safe mode ':

    Try safe mode if your Mac does not end commissioning - Apple Support

    then try to connect. If this succeeds, use

    System Preferences > users and groups > login items

    and disable/enable the suspects until what you identify the problem by a process of elimination.

    If this does not work there are more complicated things to check, such as incorrect permissions and uid duplicate, but I would try first things easy.

    C.

  • Problems with the second machine

    I have an account with creative cloud and CC (2014) CC/PS PS and LR installed on my Macbook Pro. I have the account as on my Imac. However, when I downloaded the software, it shows that all the software are only on a 30 day trial. I can't find any way to activate the software on the second machine. What am I doing wrong please.

    Bazzatee please see Sign in, activation or connection errors. CC, CS6, CS5.5 - http://helpx.adobe.com/x-productkb/policy-pricing/activation-network-issues.html for more information on how to solve the connection error prevents the activation of Adobe Creative Software.

  • Problem with the second red card

    Hola, the sober consultar queria a problem that I am having in el con host the second red card.

    Tengo UN esxi 5 desde hace one wont by Dias y estoy beginning an armar una pequeña infrastructure virtual, en el host estoy necesitando una segunda tarjeta red are only in el mismo voy a put a device that makes a kind of proxy, por lo Québec Necesito tener tarjetas UN 2 red, pero el just greet me detecta to edge.

    Don't probe change the tarjeta por otras pero no reconoce la, son todas tarjetas genericas estan bullfighting in the list of compatibility than por eso por no haber problemas should.

    He buscado in documentation pero las cosas as he found me None ha sido of utility.

    The found a worm if me can perform o algo a prueba alguna indicate that me can help con el problema.

    MUCHAS gracias!

    Hola Matias,

    If going to a network adapters appears todas las NIC?

    A greeting.

    Sent from my iPhone

  • Problem of IR with COUNT (*) (AS apxws_row_cnt)

    Hello world

    I use the same question raised in the IR problem with COUNT (*) () AS apxws_row_cnt discussion Forum, by Marco 1975. I'm developing on APEX 5.0.0.0.31 and using the Oracle 12 c DB. An IR translates 4648 occurrences only 100 records. The SQL is okay, but the OVER() COUNT (*) AS apxws_row_cnt done something witcthery on my report.  Anyone has any idea how to solve this problem in 5 APEX?

    My query:

    SELECT PK_EMPLOYEE,

    DATE_HIRE,

    DATE_QUIT,

    DBMS_LOB. GetLength ("foto") "FOTO"

    NAME,

    CPF

    OF TB_EMPLOYEE

    I found, helped by 3rd party experts - CITS Brasília - workaround using nested selects to avoid the Cartesian product of my request on IR. This is a Cartesian product of column FOTO ("PHOTO") against a column of master FK from another TABLE.

    In any case there is the solution, I'm sorry for the Portuguese terms, but I understand that it will be quite understandable:

    SELECT DISTINCT NULL as apxws_row_pk, "PK_EMPREGADO", "CPF", "NAME", "FOTO", "DATA_CONTRATACAO", "DATA_DISPENSA", count (*) (as apxws_row_cnt)

    FROM (SELECT * FROM ())

    SELECT

    b."PK_EMPREGADO."

    ----------------------------------------------------------

    --> Cartesian product: PHOTOS N versus Post - Posto Trabalho work 01

    -"FK_POSTOS_TRABALHO"

    -------------------------------------------------------------

    -nvl (L1. ("" "' DISPLAY_VALUE ', b." FK_POSTOS_TRABALHO ") as"FK_POSTOS_TRABALHO,"

    ------------------------------------------------------------

    «"" "" "" b."FCP", b."NOME", b. "FOTO", b. ' DATA_CONTRATACAO ', b. "DATA_DISPENSA»

    FROM (SELECT * FROM (select distinct emp.) PK_EMPREGADO, emp. FK_POSTOS_TRABALHO, emp. FCP, emp. DATA_CONTRATACAO, emp. DATA_DISPENSA, emp. NOME, dbms_lob.getlength (emp. FOTO) "FOTO".

                  OF TB_EMPREGADO emp

    RIGHT JOIN TB_POSTOS_TRABALHO_HOM pt ON (pt. PK_POSTOS_TRABALHO = emp. FK_POSTOS_TRABALHO)

    TB_EXECUTORES of RIGHT JOIN ex WE: APP_USER IS NOT NULL and: APP_USER = e.g. MATRICULA AND pt. FK_CONTRATADA = e.g. FK_CONTRATADA WHERE emp.cpf IS NOT NULL

    ) ) b,

    (SELECT NUM_CONTRATO |) ' - ' || DESCRIPTION as display_value, FK_POSTOS_TRABALHO as return_value

    OF terceirizado. TB_CONTRATADA cont, terceirizado. Post TB_POSTOS_TRABALHO_HOM, terceirizado. Tipo TB_TIPO_HOM, terceirizado. TB_EMPREGADO emp

    WHERE to post. TYPE = type. PK_TIPO and cont. PK_CONTRATADA = post. FK_CONTRATADA and emp. FK_POSTOS_TRABALHO = post. PK_POSTOS_TRABALHO

    L1 OF THE ORDER OF 1)))

    I hope that Oracle will provide a coherent solution for COUNT (*) () AS apxws_row_cnt question.

  • Problem with the Dell powerconnect 5424

    Hi all!!

    I got 2 switch dell powerconnect 5424. I set them up with an IP and everything goes well (for now).

    But when I connect a switch on the network I have this message:

    1 January 2000 00:01:07 % STP-W-PORTSTATUS: g21: STP Forwarding State
    1 January 2000 00:01:27 % STP-W-PORTSTATUS: g21: STP Blocking status
    1 January 2000 00:01:27 % STP-W-LOOPBACKDET: g21: STP loop detection.
    1 January 2000 00:01:42 % STP-W-LOOPBACKDETRSLV: g21: fixed STP loop detection.

    I do not understand because there is only the network (port 21) and my computer that are not connected so no possible closure.

    There is the same problem with the second switch, so I think this isn't a hardware problem.

    Someone has an idea to help me?

    Thank you


  • Problem with VGA card after Windows Update

    Hi all.

    Today I start to address a problem with me second VGA card (Matrox G200 G2 + / QUADP-PL/7) after a yesterday updated windows.
    I am able to see the other 4 monitors, but with a yellow triangle.
    You thing has remove updates yesterday going to solve my problem?

    PS:If you have an another idea is welcome

    Thank you and best regards.

    Hello

    Please contact Microsoft Community.

    This problem may occur if the VGA card drivers are updated after the installation of Windows updates. I suggest to follow the steps below and check to see if problem persists.

    1. Click Start and stop in the search box, type Device Manager.
    2. On top, on the start menu, click on "Device Manager".
    3. In "Device Manager", double click "Graphics card" expand. "."
    4. Click on "display Matrox G200 G2 + / QUADP-PL/7 ' and click 'properties '.
    5. In properties, click on the "Drivers" tab and check if the option 'Return to the version' is 'active '. If so click on "Roll back" to restore the previous version driver.

    Note: If "Roll back" is greyed out, then see the article restoration of the system;

    Warning: When you use system restore to restore the computer to a previous state, the programs and updates that you have installed are removed.

    Important: try to restore your system to an earlier date when everything worked correctly.

    http://Windows.Microsoft.com/en-in/Windows7/products/features/system-restore

    Meet us, then we can help you further.

  • 2nd monitor problems with Photoshop CS4 and CC

    I'm on a quest to solve a problem with my second monitor when using Photoshop. When I hit F in photoshop to switch between display modes or when I Zoom in or out this happens:

    IMG_2010.JPG

    OK, well it is turned on its side, but you get the point. Until very recently, I used OS x 10.6.8 with Photoshop CS4 with no problems but ran into some problems with applications etc so I upgraded to Yosemite. That's when the problem started. In order to solve what I did a clean install of Mavericks in the hope that Yosemite was too new and that he had not brought bugs. Then I reinstalled CS4 there more this problem, but another problem just as boring. the profile for the 2nd monitor appears so desaturated and terrible that I can't use it to edit, despite several attempts to recalibrate.

    Out of curiosity I tried the trial of CC in Photoshop to see if the problem of mosaic has been fixed, but it wasn't. Right now looked at color, but mosaic problem. Here is the info on my computer:

    Screen Shot 2015-02-04 at 4.01.28 PM.png

    I changed in system preferences > energy saver > graphics for better quality, but nothing has changed. In Photoshop, I tried Preferences > performance > the GPU settings > advanced settings > changed in Basic drawing and that did not solve the problem either. Any ideas?

    10.10 MacOS still has a number of video driver bugs, some causing display corruption and others causing accidents.

    Apple is aware of these driver problems and work on solutions.

    Turning off the use of Photoshop GPU can help.

    But if you need the GPU features, you can return to a stable version of MacOS.

  • Problem with the scene selection menu

    I have two pages of scene selection menu.  The first page works fine but I have problems with the second page.  The highlite flashes market either on stage or on the main menu or on the arrow to return to the previous page.  So that he can move or do anything, the only way is to click on it when it flashes on.

    Is it possible to add buttons so I can have all my selections on 1 page?

    Yes. As Ann says you can do in Photoshop. As she points out, carefully study the structure of the layer of one of the Menus library. The small symbols at the beginning of the names of the layers are very important. Also, explore the different layers in the button layer sets. They have too specialized for naming conventions that must be followed and don't forget to turn off the visibility for any layer to highlight (highlight the secondary image button). It will be lit, when your user has access to this button.

    Also, is there a limit to how many buttons can have on a Menu by the DVD specifications. IIRC, it's 32 for 4:3 Menus and 16 for 16:9 Menus. Not sure if these exact limits apply to Menus of comics, but we are talking about DVD-video here and not comics.

    In addition, when you look at the Menu. PSD in Photoshop, special attention to the order button layer sets. Button #1 will be at the bottom of the Palette layers with button #2 above and so on. He also established the button routing, which is what happens when you press the arrow keys on a remote DVD player.

    In, you can edit routing button to do what you want. I think the button routing is only automatic in PrPro. You can check this. Unfortunately, I used PrPro to authoring only rarely and still dependent on the Auto-Play everything but simple DVD-Videos.

    Good luck

    Hunt

  • Satellite M40X-184: problem with keyboard - only writes a character in 1 second

    Hello

    There is an interesting problem with my laptop, it cams with Xp Home edition with 1 partition, I used partition magic to create another and then format C:, after installation of XP Pro. Install drivers one by one, now when I try to write something in anywhere like msn, notepad or Word, she wrote just a character in 1 second;

    Like when I write "trial" he write in 5 seconds... Why what happened and above all how can I work this?

    Hello

    have you tried to uninstall the pilot how you installed? Maybe you should do this, I think it's probably just a software problem and no hardware failure.
    So you can also try to set the rate of your keyboard type in Control Panel-> keyboard control-> (delay repeat, repeat rate) and maybe it s just there a setting that needs to be corrected.

    Welcome them

  • Problem with the icons on the second monitor

    Original title: I had the image of the desktop without icons, when I added another monitor, but can not get the screen of the laptop to display on the screen 2 real. I have enable VGA on media center edition XP

    I had the image of the desktop without icons, when I added another monitor, but can not get the screen of the laptop to display on the screen 2 real. I activated the VGA on the media center XP edition

    Hello

    If I understand the question, you have a problem with icons on the second monitor.

    Please let me know if this is not correct. You have reached the right forum for your question. We are here to help solve your problem and guide you in the right direction.

    I suggest you try the procedure described in the article and see if it helps.

    How to configure and use multiple monitors in Windows XP
    http://support.Microsoft.com/kb/307873

    You can check the link for more information:

    Setting up dual monitor: two screens are better than one
    http://www.Microsoft.com/athome/organization/twomonitors.aspx#fBid=jiVGYS2SKfo

    Please let me know if this is not correct. You have reached the right forum for your question. We are here to help solve your problem and guide you in the right direction.

Maybe you are looking for

  • In a roaming network, Mac always connects with AE which is further away

    So, I had a roaming network for years to host a detached office which was too far from my house.  Worked very well.  Now, my family and I have moved into a temporary rented condo (two floors).  Therefore, there is a lot of wifi networks in the area i

  • Cannot select photos from the Photos app

    Hey! Whenever I want to download pictures on iMovie, Facebook, by selecting a new wallpaper etc when I go to select my photos of Photos (which replaces iPhotos), none of my photos or photo albums can be viewed or selected. There is a buffering icon i

  • Note Microsoft Office One 2003

    This software has been loaded on my laptop but I wonder a product key to activate it. I don't have a CD or product and wonde key if there is a way of obtaining.

  • Windows 10 compatibility with applications developed in LabView

    We have deployed several applications developed in LabView that are running OK under Win7 and Win8.x. Are there problems of known incompatibility with 10 Windows and applications created with "LV2012 SP1 that read data from cards NiDaq". We should wa

  • New HDD for system recovery DVD

    My Pavilion dv4-1225dx Entertainment Notebook has experienced a hard drive crash.  I replaced the hard drive with a new WD Scorpio Blue 2.5-inch 500 GB SATA drive.  I got HP System Recovery DVD to reinstall the operating system Windows Vista Home Pre