@sswroom/sswr 1.6.18 → 1.6.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/Changelog +4 -0
  2. package/data.js +36 -6
  3. package/package.json +1 -1
package/Changelog CHANGED
@@ -1,3 +1,7 @@
1
+ 1.6.19
2
+ -data.Timestamp.fromTicks support floating point ticks
3
+ -data.Duration.fromTicks support floating point ticks
4
+
1
5
  1.6.18
2
6
  -Change geometry.LinearRing.getHIntersactsCenter to getIntersactsCenter
3
7
  -web.buildTable support StaticImage item
package/data.js CHANGED
@@ -1856,8 +1856,18 @@ export class Duration
1856
1856
  {
1857
1857
  if (ticks < 0)
1858
1858
  {
1859
- let ns = Number(BigInt(ticks) % 1000n);
1860
- let seconds = BigInt(ticks) / 1000n;
1859
+ let ns;
1860
+ let seconds;
1861
+ if (typeof ticks == "number")
1862
+ {
1863
+ seconds = Math.floor(ticks / 1000);
1864
+ ns = (ticks - seconds * 1000);
1865
+ }
1866
+ else
1867
+ {
1868
+ ns = Number(BigInt(ticks) % 1000n);
1869
+ seconds = BigInt(ticks) / 1000n;
1870
+ }
1861
1871
  if (ns != 0)
1862
1872
  {
1863
1873
  ns = (-ns) * 1000000;
@@ -1867,7 +1877,15 @@ export class Duration
1867
1877
  }
1868
1878
  else
1869
1879
  {
1870
- return new Duration(BigInt(ticks) / 1000n, Number(BigInt(ticks) % 1000n) * 1000000);
1880
+ if (typeof ticks == "number")
1881
+ {
1882
+ let secs = Math.floor(ticks / 1000);
1883
+ return new Duration(secs, (ticks - secs * 1000) * 1000000);
1884
+ }
1885
+ else
1886
+ {
1887
+ return new Duration(BigInt(ticks) / 1000n, Number(BigInt(ticks) % 1000n) * 1000000);
1888
+ }
1871
1889
  }
1872
1890
  }
1873
1891
 
@@ -2189,14 +2207,26 @@ export class TimeInstant
2189
2207
  */
2190
2208
  static fromTicks(ticks)
2191
2209
  {
2192
- let ms = Number(BigInt(ticks) % 1000n);
2210
+ let secs;
2211
+ let ms;
2212
+ if (typeof ticks == "number")
2213
+ {
2214
+ secs = Math.floor(ticks / 1000);
2215
+ ms = (ticks - secs) * 1000;
2216
+ secs = BigInt(secs);
2217
+ }
2218
+ else
2219
+ {
2220
+ secs = BigInt(ticks) / 1000n;
2221
+ ms = Number(BigInt(ticks) % 1000n);
2222
+ }
2193
2223
  if (ms < 0)
2194
2224
  {
2195
- return new TimeInstant(Math.floor(Number(ticks) / 1000) - 1, (ms + 1000) * 1000000);
2225
+ return new TimeInstant(secs - 1n, (ms + 1000) * 1000000);
2196
2226
  }
2197
2227
  else
2198
2228
  {
2199
- return new TimeInstant(Math.floor(Number(ticks) / 1000), ms * 1000000);
2229
+ return new TimeInstant(secs, ms * 1000000);
2200
2230
  }
2201
2231
  }
2202
2232
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sswroom/sswr",
3
- "version": "1.6.18",
3
+ "version": "1.6.19",
4
4
  "description": "Libraries made by sswroom",
5
5
  "main": "sswr.js",
6
6
  "scripts": {