SHARE
TWEET

Untitled

a guest Sep 13th, 2017 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. [
  2.     {
  3.         "id": "c67af34f.cfd1",
  4.         "type": "function",
  5.         "z": "9b7d2645.a72f18",
  6.         "name": "deltaT",
  7.         "func": "\nvar prev = flow.get('prev')||0;\n\nvar d = new Date();\nvar n = d.getMilliseconds();\n\nif (msg.topic == \"timestamp\"){\n    flow.set('prev', n);\n}\n   \nelse {\n    if (n<prev) {\n        //console.log(\"OVERFLOW!\");\n        n=n+1000;\n    }\n    //console.log(\"tDiff = \",n,\"-\",prev,\"=\",n-prev);\n    console.log(n-prev);\n}\n\nreturn msg;",
  8.         "outputs": 1,
  9.         "noerr": 0,
  10.         "x": 382.5,
  11.         "y": 241,
  12.         "wires": [
  13.             [
  14.                 "da5c6847.6b87f8"
  15.             ]
  16.         ]
  17.     }
  18. ]
RAW Paste Data
Top