Index: /branches/eam_branches/ipp-dev-20210817/Ohana/src/uniphot/src/load_images_fixhsc.c
===================================================================
--- /branches/eam_branches/ipp-dev-20210817/Ohana/src/uniphot/src/load_images_fixhsc.c	(revision 41834)
+++ /branches/eam_branches/ipp-dev-20210817/Ohana/src/uniphot/src/load_images_fixhsc.c	(revision 41835)
@@ -38,5 +38,5 @@
     // the rule is the new base photcode
     // this is robust against multiple passes
-    short chipcode = 1000 * (int)(photcode / 1000);
+    short chipcode = photcode % 200;
 
     short newcode  = newbase + chipcode;
Index: /branches/eam_branches/ipp-dev-20210817/Ohana/src/uniphot/src/load_rules_fixhsc.c
===================================================================
--- /branches/eam_branches/ipp-dev-20210817/Ohana/src/uniphot/src/load_rules_fixhsc.c	(revision 41834)
+++ /branches/eam_branches/ipp-dev-20210817/Ohana/src/uniphot/src/load_rules_fixhsc.c	(revision 41835)
@@ -2,6 +2,6 @@
 
 static int    Nrule = 0;
-static double *startRule     = NULL;
-static double *stopRule      = NULL;
+static e_time *startRule     = NULL;
+static e_time *stopRule      = NULL;
 static int    *photbaseRule  = NULL;
 
@@ -16,15 +16,21 @@
   int NRULE = 10000;
 
-  ALLOCATE_PTR (startRule, double, NRULE);
-  ALLOCATE_PTR (stopRule,  double, NRULE);
-  ALLOCATE_PTR (photbaseRule, int, NRULE);
+  ALLOCATE (startRule, e_time, NRULE);
+  ALLOCATE (stopRule,  e_time, NRULE);
+  ALLOCATE (photbaseRule, int, NRULE);
 
-  while (fscanf (f, "%lf %lf %d", &startRule[Nrule], &stopRule[Nrule], &photbaseRule[Nrule]) != EOF) {
+  double startMJD, stopMJD;
+
+  // rules are in MJD, convert to e_time values
+  while (fscanf (f, "%lf %lf %d", &startMJD, &stopMJD, &photbaseRule[Nrule]) != EOF) {
+
+    startRule[Nrule] = ohana_mjd_to_sec (startMJD);
+    stopRule[Nrule]  = ohana_mjd_to_sec (stopMJD);
     Nrule ++;
 
     if (Nrule >= NRULE) {
       NRULE += 10000;
-      REALLOCATE (startRule, double, NRULE);
-      REALLOCATE (stopRule,  double, NRULE);
+      REALLOCATE (startRule, e_time, NRULE);
+      REALLOCATE (stopRule,  e_time, NRULE);
       REALLOCATE (photbaseRule, int, NRULE);
     }
Index: /branches/eam_branches/ipp-dev-20210817/Ohana/src/uniphot/src/update_catalog_fixhsc.c
===================================================================
--- /branches/eam_branches/ipp-dev-20210817/Ohana/src/uniphot/src/update_catalog_fixhsc.c	(revision 41834)
+++ /branches/eam_branches/ipp-dev-20210817/Ohana/src/uniphot/src/update_catalog_fixhsc.c	(revision 41835)
@@ -11,9 +11,9 @@
     if (!newbase) continue;
     
-    short photcode = catalog[0].measure[i].photcode;
+    unsigned short photcode = catalog[0].measure[i].photcode;
 
     // the rule is the new base photcode
     // this is robust against multiple passes
-    short chipcode = 1000 * (int)(photcode / 1000);
+    short chipcode = photcode % 200;
 
     short newcode  = newbase + chipcode;
